Install Unity SDK for Android
- Player Network SDK 1.24 and later
- Before Player Network SDK 1.24
androidx
minSdkVersion: 19
targetSdkVersion: 34
compileSdkVersion: 34
For LINE, upgrade minSdkVersion to 19.
For Firebase, upgrade minSdkVersion to 19, upgrade Android Gradle to V6.7.1 and above, and upgrade Android Gradle Plugin to V4.2.0 and above.
For Kakao, VK, upgrade minSdkVersion to 21.
For Discord, DMM, upgrade minSdkVersion to 23.
For Adjust, upgrade minSdkVersion to 18.
androidx
minSdkVersion: 16
targetSdkVersion: 34
compileSdkVersion: 34
For LINE, upgrade minSdkVersion to 19.
For Firebase, upgrade minSdkVersion to 19, upgrade Android Gradle to V6.7.1 and above, and upgrade Android Gradle Plugin to V4.2.0 and above.
For Kakao, VK, upgrade minSdkVersion to 21.
For Discord, DMM, upgrade minSdkVersion to 23.
For Adjust, upgrade minSdkVersion to 18.
Prerequisites
The version of each SDK plugin used by the game, including the version used by the game launcher, must be consistent. If games require access to multiple versions of Player Network SDK at the same time, or if only one component needs to be upgraded, reach out to the Player Network representative.
- Get a login account from Player Network.
- Create a new project.
- [Optional] Invite users to join the project.
- Download the SDK.
Step 1: Install the SDK
1. Add Player Network SDK to your project
- Unzip the SDK package.
- Copy the
INTLSDK
folder to theAssets
folder of your project. - Merge the
Plugins
folder of Player Network SDK to thePlugins
folder of your project.
Player Network SDK package
├─INTLSDK // Player Network SDK CS scripts which provide APIs and callbacks
│ ├─Editor // Player Network SDK Editor scripts which include Player Network SDK XUPorter
│ └─Scripts // Player Network SDK scripts which include INTLCore and other plugin scripts
├─LevelInfinite // LI PASS APIs
├─Plugins // Player Network SDK plugins for various platforms
│ ├─Android
│ ├─iOS
│ ├─MacOS
│ └─Windows~
├─Symbols // Player Network SDK symbol table *.so files
└─UnionAdapter // UnionAdpater APIs which adapts to both MSDK and Player Network SDK
INTLSDK/Scripts/INTLCore
├─INTLSDK
│ ├─Editor
│ └─Scripts
│ ├─INTLConfig
| └─INTLCore
| ├─Editor // INTLCore PostProcess.cs / PreProcess.cs files for different platforms
| | ├─INTLCoreAndroidPostProcess.cs
| | ├─INTLCoreiOSPostProcess.cs
| | ├─INTLCoreMacOSPostProcess.cs
| | ├─INTLCoreWindowsPostProcess.cs
| | └─INTLCoreWindowsPreProcess.cs
| └─Scripts // INTLCore scripts
| ├─INTLAPI.cs // Player Network SDK APIs
| ├─INTLConfig.cs // Player Network SDK data structures
| ├─INTLDefine.cs // Player Network SDK static strings
| ├─INTLErrorCode.cs // Player Network SDK error codes
| ├─Modules
| └─Utils
├─LevelInfinite
├─Plugins
├─Symbols
└─UnionAdapter
INTLSDK/Script/INTLConfig
├─INTLSDK
│ ├─Editor
│ └─Scripts
│ ├─INTLConfig
| | └─Editor // Player Network SDK configuration files, PostProcess.cs files, and encryption tools
| | ├─Encrypt
| | | ├─decrypt // Player Network SDK decryption tool for INTLConfig.ini
| | | ├─Decrypt.exe // Player Network SDK decryption tool for INTLConfig.ini
| | | ├─encrypt // Player Network SDK encryption tool for INTLConfig.ini
| | | ├─Encrypt.exe // Player Network SDK encryption tool for INTLConfig.ini
| | | ├─EncryptConfig.ini // Player Network SDK file to enable or disable INTLConfig.ini encryption
| | | ├─INTLConfigINI.cs
| | | ├─INTLConfigINIEditor.cs
| | | └─INTLEditorTools.cs
| | ├─INTLConfigAndroidPostProcess.cs
| | ├─INTLConfigiOSPostProcess.cs
| | ├─INTLConfigMacOSPostProcess.cs
| | ├─INTLConfigSwitchPreProcess.cs
| | ├─INTLConfigWind...sPostProcess.cs
| | └─Resources // Player Network SDK configurations
| | ├─APASConfig.ini // APAS device level configuration file
| | └─INTLConfig.ini // Player Network SDK main configuration file
| └─INTLCore
├─LevelInfinite
└─Plugins
2. Load required permissions and plugins
If you have not created an Android custom activity for your game, see Create a custom activity.
Add Player Network SDK codes for loading permissions, libraries, and plugins to the custom launch activity, which is where Android games ask for permissions and load plugins.
Add code for loading libraries
static {
try {
System.loadLibrary("INTLFoundation");
System.loadLibrary("INTLCore");
System.loadLibrary("INTLUnityAdapter");
}
catch (Exception e) {
e.printStackTrace();
}
}
Add code to register activity lifecycle
import com.intlgame.api.INTLSDK;
import android.content.Intent;
import android.os.Bundle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// add this line
INTLSDK.initialize(MainActivity.this);
}
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// add this line
INTLSDK.onNewIntent(intent);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// add this line
INTLSDK.onActivityResult(requestCode, resultCode, data);
}
@Override
public void onRequestPermissionsResult(int arg0, String[] arg1, int[] arg2) {
super.onRequestPermissionsResult(arg0, arg1, arg2);
// add this line
INTLSDK.onRequestPermissionsResult(arg0, arg1, arg2);
}
Load dynamic permissions
Get dynamic permissions through code
Add the following code to request permissions dynamically:
import android.app.Activity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import java.util.ArrayList;
import java.util.List;
private void RequestPermission(Activity activity, List<String> permissionList, int requestCode) {
if (null != activity && null != permissionList) {
List<String> permissionNeeded = new ArrayList();
for (int i = 0; i < permissionList.size(); ++i) {
String permission = (String) permissionList.get(i);
if (null != permission && 0 != ContextCompat.checkSelfPermission(activity.getApplicationContext(), permission)) {
permissionNeeded.add(permission);
}
}
if (permissionNeeded.size() > 0) {
ActivityCompat.requestPermissions(activity, (String[]) permissionNeeded.toArray(new String[permissionNeeded.size()]), requestCode);
}
}
}
private void RequestDynamicPermissions() {
List<String> permissions = new ArrayList();
permissions.add("android.permission.INTERNET");
permissions.add("android.permission.READ_PHONE_STATE");
this.RequestPermission(this, permissions, 100);
}
Call RequestDynamicPermissions
:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// add this line
RequestDynamicPermissions();
INTLSDK.initialize(MainActivity.this);
}
Add compatibility for notched displays
Since Android P, Android has provided standard APIs for notched display compatibility. However, for Android O devices, different vendors have different implementation logic. Player Network SDK provides standardized C++ APIs and Java APIs to support various Android O devices like Xiaomi, Huawei, Samsung, VIVO, and OPPO.
Player Network SDK includes an INTLUnityAdapter
module for Unity games which allows games to use C# to make unmanaged calls to C++ APIs. For more information, see Asynchronous Notched Display Information Reading.
Generally, the full-screen aspect ratio for mobile phones is greater than 2.1. To avoid black borders, users must modify android.max_aspect
to be greater than 2.1.
For Huawei and Xiaomi phones with the Android Oreo OS, users must configure AndroidManifest
.
<!--Supports full-screen aspect ratio of 2.4 to adapt to the future 21:9 ultra-widescreen-->
<meta-data android:name="android.max_aspect" android:value="2.4" />
<!--Xiaomi O version definition: Whether to use ear areas (high-risk area)-->
<!--values:
none: ear areas not rendered in portrait or landscape mode,
portrait: ear areas rendered in portrait mode,
landscape: ear areas rendered in landscape mode,
portrait|landscape: ear areas rendered in both portrait and landscape mode
-->
<meta-data android:name="notch.config" android:value="portrait|landscape"/>
<!--Huawei O version definition: App pages use notch area-->
<meta-data android:name="android.notch_support" android:value="true"/>
For games using Android APIs to get safe area information for notched displays, add the following configurations:
Add the following code to MainActivity
.
import android.os.Build;
import android.view.WindowManager;
import android.view.View;
private void setFullScreen()
{
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);// Set full screen
int systemUiVisibility = 0;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
systemUiVisibility = this.getWindow().getDecorView().getSystemUiVisibility();
int flags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
systemUiVisibility |= flags;
getWindow().getDecorView().setSystemUiVisibility(systemUiVisibility);
}
// P version is allowed to use the notch area
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
WindowManager.LayoutParams lp = this.getWindow().getAttributes();
lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
this.getWindow().setAttributes(lp);
}
}
Call setFullScreen()
here.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// add this line
setFullScreen();
this.RequestDynamicPermissions();
INTLSDK.initialize(this);
}
In PlayerSetting, select Render outside safe area.
3. Generate JAR package
Player Network SDK uses Gradle build to generate JAR packages. The Gradle configuration file includes third-party SDK version numbers and the dependencies required by Player Network SDK and third-party channels. Games need to add necessary dependencies based on the plugins required.
The mainTemplate.gradle
and INTLCore.mainTemplate.gradle
files are Player Network SDK Gradle configuration files. Update the Gradle configurations based on the game requirements.
Unity 2018
File | Path |
---|---|
mainTemplate.gradle | Plugins/Android |
INTLCore.mainTemplate.gradle | Plugins/Android/Gradle |
There are at least two updates:
- Merge the
mainTemplate.gradle
from your game to themainTemplate.gradle
in Player Network SDK and keep the content marked by Player Network SDK.
buildscript {
repositories {**ARTIFACTORYREPOSITORY**
// ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ Player Network SDK ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
maven {
url "https://mirrors.tencent.com/nexus/repository/maven-public/"
}
maven {
url "https://mirrors.tencent.com/repository/maven/thirdparty"
}
// ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ Player Network SDK ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
mavenCentral()
google()
jcenter()
}
dependencies {
// ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ Player Network SDK ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
classpath 'com.android.tools.build:gradle:4.0.1'
// ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ Player Network SDK ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
**BUILD_SCRIPT_DEPS**
}
}
allprojects {
repositories {**ARTIFACTORYREPOSITORY**
// ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ Player Network SDK ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
maven {
url "https://mirrors.tencent.com/nexus/repository/maven-public/"
}
maven {
url "https://mirrors.tencent.com/repository/maven/thirdparty"
}
// ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ Player Network SDK ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
mavenCentral()
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
- Follow the instructions for third-party channel integration.
- Replace the
{placeholder}
text inINTLCore.mainTemplate.gradle
with the value from the INTLConfig.ini configuration file.
android {
compileSdkVersion rootProject.ext.common.compileSdkVersion
buildToolsVersion rootProject.ext.common.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.common.minSdkVersion
targetSdkVersion rootProject.ext.common.targetSdkVersion
multiDexEnabled rootProject.ext.common.minSdkVersion < 21
manifestPlaceholders = [
"FACEBOOK_APPID" : "{INTL_FACEBOOK_APP_ID}",
"GOOGLE_APPID" : '{INTL_GOOGLE_APP_ID}',
"FACEBOOK_CLIENT_TOKEN" : "{INTL_FACEBOOK_CLIENT_TOKEN}",
'GOOGLEPGS_APPID' : '{INTL_GOOGLEPGS_APPID}',
'VK_APPID' : '{INTL_VK_APP_ID}',
'GARENA_APP_ID' : '{INTL_GARENA_APP_SDK_ASSIGN_ID}',
'QQ_APPID' : '{INTL_QQ_APP_ID}',
'GOOGLE_CLIENT_ID' : '{INTL_GOOGLE_CLIENT_KEY_ANDROID}',
'DISCORD_APP_ID' : '{INTL_DISCORD_APP_ID}',
'DISCORD_REDIRECT_SCHEME' : '{INTL_DISCORD_REDIRECT_SCHEME}',
'DISCORD_REDIRECT_HOST' : '{INTL_DISCORD_REDIRECT_HOST}',
'DISCORD_REDIRECT_PATH' : '{INTL_DISCORD_REDIRECT_PATH}',
'DMM_LOGIN_ACTIVITY_DATA_SCHEME': '{INTL_DMM_LOGIN_ACTIVITY_DATA_SCHEME}',
'KAKAO_APP_SECRET' : '{INTL_KAKAO_APP_SECRET}',
'KAKAO_APP_ID' : '{INTL_KAKAO_APP_ID}',
'VNG_GG_APP_ID' : '{INTL_VNG_GG_APP_ID}',
'VNG_GG_CLIENT_TOKEN' : '{INTL_VNG_GG_CLIENT_TOKEN}',
]
}
}
Unity 2019 and later
File | Path |
---|---|
mainTemplate.gradle | Plugins/Android |
baseProjectTemplate.gradle | Plugins/Android |
launcherTemplate.gradle | Plugins/Android |
INTLCore.mainTemplate.gradle | Plugins/Android/Gradle |
INTLCore.baseProjectTemplate.gradle | Plugins/Android/Gradle |
INTLCore.launcherTemplate.gradle | Plugins/Android/Gradle |
There are at least two updates:
- Merge the
mainTemplate.gradle
,baseProjectTemplate.gradle
, andlauncherTemplate.gradle
from your game to the respective Gradle file in Player Network SDK and keep the content marked by Player Network SDK.
// ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ Player Network SDK - INTLCore ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
dependencies {
implementation "androidx.appcompat:appcompat:1.4.0-alpha03"
implementation "androidx.annotation:annotation:1.0.0"
implementation "com.google.android.gms:play-services-ads-identifier:17.0.0"
// Migrated to :app
// implementation "com.google.android.play:core:1.10.0"
}
// ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ Player Network SDK - INTLCore ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
// ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ Player Network SDK - INTLFacebook ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
dependencies {
implementation "androidx.annotation:annotation:1.0.0"
implementation "com.facebook.android:facebook-login:16.1.3"
implementation "com.facebook.android:facebook-share:16.1.3"
implementation "com.facebook.android:facebook-core:16.1.3"
implementation "com.facebook.android:facebook-gamingservices:16.1.3"
implementation "com.facebook.android:facebook-common:16.1.3"
implementation "com.facebook.android:facebook-applinks:16.1.3"
}
// ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ Player Network SDK - INTLFacebook ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
// ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ Player Network SDK ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
apply from: "$rootDir/INTL.Gradle/INTLCore.mainTemplate.gradle"
// ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ Player Network SDK ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
- Follow the instructions for third-party channel integration.
- Replace the
{placeholder}
text inINTLCore.launcherTemplate.gradle
with the value from theINTLConfig.ini
configuration file.
android {
compileSdkVersion rootProject.ext.common.compileSdkVersion
buildToolsVersion rootProject.ext.common.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.common.minSdkVersion
targetSdkVersion rootProject.ext.common.targetSdkVersion
multiDexEnabled rootProject.ext.common.minSdkVersion < 21
manifestPlaceholders = [
"FACEBOOK_APPID" : "{INTL_FACEBOOK_APP_ID}",
"FACEBOOK_CLIENT_TOKEN" : "{INTL_FACEBOOK_CLIENT_TOKEN}",
"GOOGLE_APPID" : '{INTL_GOOGLE_APP_ID}',
'GOOGLEPGS_APPID' : '{INTL_GOOGLEPGS_APPID}',
'VK_APPID' : '{INTL_VK_APP_ID}',
'GARENA_APP_ID' : '{INTL_GARENA_APP_SDK_ASSIGN_ID}',
'QQ_APPID' : '{INTL_QQ_APP_ID}',
'GOOGLE_CLIENT_ID' : '{INTL_GOOGLE_CLIENT_KEY_ANDROID}',
'DISCORD_APP_ID' : '{INTL_DISCORD_APP_ID}',
'DISCORD_REDIRECT_SCHEME' : '{INTL_DISCORD_REDIRECT_SCHEME}',
'DISCORD_REDIRECT_HOST' : '{INTL_DISCORD_REDIRECT_HOST}',
'DISCORD_REDIRECT_PATH' : '{INTL_DISCORD_REDIRECT_PATH}',
'DMM_LOGIN_ACTIVITY_DATA_SCHEME': '{INTL_DMM_LOGIN_ACTIVITY_DATA_SCHEME}',
'KAKAO_APP_SECRET' : '{INTL_KAKAO_APP_SECRET}',
'KAKAO_APP_ID' : '{INTL_KAKAO_APP_ID}',
'VNG_GG_APP_ID' : '{INTL_VNG_GG_APP_ID}',
'VNG_GG_CLIENT_TOKEN' : '{INTL_VNG_GG_CLIENT_TOKEN}',
]
}
}
4. Player Network SDK Configuration
When INTLConfig.ini
is modified manually, reach out to the Player Network representative to confirm if configuration changes meet expectations, see SDK Config Information for more information.
Follow the instructions in INTLConfig.ini to configure accordingly.
5. Initialize the SDK
Before implementing any Player Network features, initialize the SDK first.
INTLAPI.IsDebug = true; // Set the SDK to the Debug mode to print out logs. The default value is false.
INTLAPI.InitSDK();
Step 2: Verify that Player Network SDK is successfully connected
- Modify the configuration under the
INTL Log
node in the INTLConfig.ini file.
[INTL Log]
LOG_LEVEL = 1
LOG_ENCRYPT_ENABLE = 0
LOG_COMPRESS_ENABLE = 0
LOG_CONSOLE_OUTPUT_ENABLE = 1
LOG_FILE_OUTPUT_ENABLE = 1
- Run the program, integration is successful when
Init INTL SDK success.
can be found in the log.
Recommended services
Now that the Player Network SDK has been successfully connected, you are ready to start building your project.
We recommend using the following services with Player Network:
- Refer to our Authentication tutorials for a list of third-party identity providers you can incorporate into your project.
- See Social for more information on the various social features that can be used to improve player interaction.
- For instructions on how to configure in-game announcements and push notifications, see Engagement.
- See Data Insights for ways to collect and report telemetry data.
- Check out Tools & Utilities for a list of convenient tools provided by Player Network, such as Deep Link and WebView.
- Depending on your countries/regions of release, determine the Compliance Services that may be required for your project.
Alternatively, gain access to all of the above features and more by simply adding LEVEL INFINITE PASS to your project.
Regular users can follow the streamlined workflow for standard solutions that work on most games, while more advanced users can begin customizing their project with minimal integration involved.
For more information, reach out to the Player Network representative.