Skip to main content

Android

The purpose of this article is to explain how to set up LINE authentication so that your game can be logged in through the LINE channel using the Player Network Login Authentication Service.

Prerequisites

1. Setting up the LINE application on the LINE Developers Console

1. Create LINE application and configure channels

Before configuring the application for the desired platform, log in to the LINE Developers Console and create a developer account.With your developer account, use the LINE Developers Console and create a channel (a communication channel between LINE features and your application).

Create a channel
  1. On the Console home page, click Create New Provider and follow the on-screen instructions to create the provider.

    Image: Create a LINE Provider

  2. On the Channels tab of the Providers page, click Create a LINE Login channel.

  3. On the New Channel Creation page, enter the required information and click Create.

  4. In the Basic settings tab of the Channel page, check Channel ID and other information required for Player Network SDK configuration.

    Image:Add LINE app information

  5. Configuring channels for Android.

    In the LINE Login tab on the Channels page, enable Mobile app and enter the required information.

    Image: LINE Login settings

    To add a new channel pack name and corresponding signature to support multi-store channel packs, add a new line input message.

    Image: Multiple package name in LINE console

  6. Click Update to save the configuration.

2. Adding user rights

Immediately after creating a channel, the channel is set to Developing mode.Only channel administrators and testers can use the LINE login feature.

Adding Testers
  1. Log in to the LINE Developers Console.

  2. Select the appropriate channel from the recently visited channels on the home page.

    Image:Select LINE channel

  3. On the Channels page, click Roles.

  4. In the Roles tab, click Invite by email.

    Image: LINE permission configuration

  5. Add testers in the Invite new members section.
    Email:Tester's LINE account number
    Role: Tester

    Image:Add LINE tester

  6. Click Send Invitations to send tester invitations.

  7. Waiting for testers to accept email invitations.

  1. Obtain Player Network Console login account.
  2. Create a new project for your game, or join an existing one.
  3. Download SDK.
  4. Integrate SDK.
  5. Add LINE as the login authentication method for the service in the Player Network console.

Step 1:Configure SDK for LINE Login

caution

Since the LINE SDK is only compatible with minSdkVersion >= 24, problems may occur when running on devices with Android 7.0 or lower.The game must set minSdkVersion >= 24.

note

Since the LINE channel introduces new Java8 features, the Gradle settings must use Java8.Compile the dex with the D8 compiler.

For more information, see ANT Packages.

Java8 Compatibility
  • Unity 4.x, Unity 5.x Compatibility

    If the method count exceeds 65536, see the DexMerge article for a solution.

  • Unity 2017-2019 Compatibility

    1. Upgrade Android Gradle to version 3.2 and configure it to support Java8
    2. Upgrade Unity Gradle to 4.6 or higher (Verified by Player Network SDK:The latest version of Unity 2017 is 4.6, other versions are higher than 4.10).
    3. Upgrade buildToolsVersion to 28.0.1 or higher
  1. Open your project's INTLConfig.ini file:

    INTLConfig.ini
    [INTL environment]
    # WARNING: You should change this URL to the production environment when you release your game.
    INTL_URL = https://test.intlgame.com
    GAME_ID = {INTL_GAME_ID}
    SDK_KEY = {INTL_SDK_KEY}
    [INTL Log]
    LOG_LEVEL = 1
    LOG_CONSOLE_OUTPUT_ENABLE = 1
    LOG_FILE_OUTPUT_ENABLE = 1
    LOG_ENCRYPT_ENABLE = 0
    LOG_COMPRESS_ENABLE = 0

    [Android LifeCycle]
    LIFECYCLE = Line
    [LINE]
    LINE_CHANNEL_ID = {INTL_LINE_CHANNEL_ID}
    LINE_CHECK_SDK_VERSION_ENABLE = 1
    • Set the SDK backend environment to INTL_URL = https://test.intlgame.com.
    • Replace {INTL_GAME_ID} and {INTL_SDK_KEY} with the GAME_ID and SDK_KEY values assigned by the Player Network console.
    • Set LOG_LEVEL = 1, LOG_CONSOLE_OUTPUT_ENABLE = 1, LOG_FILE_OUTPUT_ENABLE = 1, LOG_ENCRYPT_ENABLE = 0 and LOG_COMPRESS_ENABLE = 0 to output console logs and log files without encrypting or compressing the output without encrypting or compressing the output.
    • Add Line to LIFECYCLE.For more information, please see SDK Environment.
    • Replace {INTL_LINE_CHANNEL_ID} with the ChannelID registered with LINE Developers.
    • LINE_CHECK_SDK_VERSION_ENABLE is used to verify the version of Android on the device.
      If the device's Android version is Android 4.2 or lower, calling the LINE API will return unsupported.Set the switch (Default: Enable) to 0 to disable it.However, the game needs to assess the risk of disabling the switch.
  2. Add the following code to the gradle file.

mainTemplate.gradle
android{
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
  1. Enable the D8 compilation option.
INTLCoreAndroidPostProcess.cs
public static void GenerateGradleProperties(string pathToBuiltProject) {
// ...
using(StreamWriter writer = new StreamWriter(gradlePropertiesFile, true)) {
// ...
writer.WriteLINE("android.enableD8.desugaring=true");
}
}

Step 2:Add LINE Login

LINE does not require an app to log in.

  • Android pulls up the LINE app to sign in if the LINE app is installed, and pulls up the web page to sign in if the LINE app is not installed.
  • Authorized login to LINE requires OpenID and profile permissions.The former is to get the player's LINE OpenID and the latter is to get the player's LINE access token, which can be set via the Permissions field.If the Permissions field is empty for a business, the Player Network SDK will use the OpenID and profile permissions by default when logging into LINE.
  1. Register login-related callbacks.
// Add callbacks
public void AddAuthObserver()
{
INTLAPI.AddAuthResultObserver(OnAuthResultEvent);
}

// Remove callbacks
public void RemoveAuthObserver()
{
INTLAPI.RemoveAuthResultObserver(OnAuthResultEvent);
}

// Process the INTLAuthResult callback
public void OnAuthResultEvent(INTLAuthResult ret)
{
Debug.Log($"MethodID: {ret.MethodId}");

string methodTag = "";
if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_LOGIN)
{
methodTag = "Login";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_BIND)
{
methodTag = "Bind";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_AUTOLOGIN)
{
methodTag = "AutoLogin";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_QUERY_USER_INFO)
{
methodTag = "QueryUserInfo";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_GET_AUTH_RESULT)
{
methodTag = "GetAuthResult";
}
}
  1. Call the AutoLogin interface to log in automatically.
INTLAPI.AutoLogin();
  1. If automatic login fails, call the Login interface to let the player log in manually.
INTLAPI.Login(INTLChannel.LINE); 
  1. Synchronize client authentication status with the game backend and wait for the final verification result.

Step 3: Acceptance testing for login functionality

Search for the keyword "AuthResult" in the Player Network SDK logs to confirm whether the channel name and OpenID are returned correctly.If correct, it means the integration configuration is successful, and login functionality has been successfully added.

If you encounter problems during the integration process, please refer to Frequently Asked Questions.

Step 4:Publish the game

To enable LINE login for players, set the channel to Published.

Image:Release game