Skip to main content

Player Network SDK Integration - Unreal

Prerequisites

caution

The versions of every SDK plugin used in the game (including the version used by the game launcher) must remain consistent.If the game needs to access multiple versions of the Player Network SDK at the same time or only one component needs to be upgraded, please contact the Player Network assistant.

Enter the PlayerNetwork SDK Download Page and choose the appropriate engine and platform to download the PlayerNetwork SDK.For more details, refer to the PlayerNetwork SDK Download Guide.

Step 1: Install the SDK

Engine Version Support

UE4.21 ~ UE4.27 & UE5 ~ UE5.5

Version Requirements

androidx
minSdkVersion: 21
targetSdkVersion: 34
compileSdkVersion: 34

If you integrate with LINE, minSdkVersion must be upgraded to 24.

If you integrate with Discord, minSdkVersion must be upgraded to 23.

Note before project submission for review: Starting from SDK V1.24.00, Google has added foreground service permissions declaration.If this declaration is not approved by Google, resubmitting for review may take about a week.For more information, see Specify Foreground Service Types.

1. Add Player Network SDK to your project

  1. Extract the SDK package.

  2. Copy the INTLSDK folder to the project's Plugins folder.
    If the project does not have a Plugins folder, please create one.

  3. Open your project's {ProjectName}.Build.cs file and add Player Network SDK to Unreal Engine as shown in the example.

    public INTLSample(ReadOnlyTargetRules Target) : base(Target)
    {
    PrivateDependencyModuleNames.AddRange(new string[] {
    "INTLCore",
    "INTLFoundation",
    "INTLConfig",
    });
    }
Player Network SDK package
├─INTLSDK
│ ├─INTLSDK.uplugin // Description files for Player Network SDK plugins
│ ├─Resources // Player Network SDK resources
│ └─Source // Player Network SDK plugin modules. Each module contains its own Build.cs file, libraries, and interfaces.
│ ├─INTLApple
│ ├─INTLConfig // Player Network SDK configurations
│ ├─INTLCore // Core module of Player Network SDK
│ ├─INTLDiscord
│ ├─INTLEpic
│ ├─INTLFacebook
│ ├─INTLFoundation
│ ├─INTLGoogle
│ ├─INTLKakao
│ ├─INTLLine
│ ├─INTLSteam
│ ├─INTLTwitter
│ └─INTLVK
├─LevelInfinite // LI PASS APIs
└─Symbols // Symbol table *.so files for Player Network SDK
INTLSDK/Source/INTLCore
└─INTLSDK
├─INTLSDK.uplugin
├─Resources
└─Source
├─INTLConfig
├─INTLCore
| ├─INTLCore.Build.cs // INTLCore Build.cs file
| ├─Libs // INTLCore libraries for different platforms which contain dll, lib, and other binary files.
| | ├─Android
| | ├─include
| | ├─iOS
| | ├─MacOS
| | └─Win
| ├─Private // Player Network SDK private folder
| └─Public // Player Network SDK public interfaces
| // INTLSDKAPI.h: Player Network SDK APIs
| // INTLSDKPluginObserver.h: Player Network SDK observer classes
| // INTLSDKPluginDefine.h: Player Network SDK data types
| // INTLSDKOutputUtility.h: Player Network SDK utility to process callbacks
| // INTLSDKBaseUserWidget.h: Player Network SDK base class for UserWidget which includes registration and deregistration APIs
├─INTLCustomer
├─INTLDiscord
├─INTLEpic
INTLSDK/Source/INTLConfig
└─INTLSDK
├─INTLSDK.uplugin
├─Resources
└─Source
├─INTLConfig
| ├─Configs // Player Network SDK configurations for different platform
| | ├─Android
| | | └─INTLConfig_APL.xml // Player Network SDK Android gradle configuration file
| | ├─iOS
| | | └─INTLConfig_UPL.xml
| | ├─Resources
| | | ├─APASConfig.ini // APAS device level configuration file
| | | └─INTLConfig.ini // Player Network SDK main configuration file
| ├─Encrypt
| ├─INTLConfig.Build.cs
| ├─INTLConfig.uplugin
| ├─Private
| ├─Public
| └─Resources
├─INTLCore

2. Loading required permissions and plug-ins

Add the Player Network SDK code for loading libraries and registering the Player Network SDK lifecycle to INTLCore_APL.xml located at INTLSDK/Source/INTLCore/Libs/Android (the Gradle configuration file for Android games).

Load dynamic permissions
Add dynamic permissions via code

Find the function definition for RequestDynamicPermissions() in INTLCore_APL.xml, then add the required dynamic permissions:

private void RequestDynamicPermissions()
{
List<String> permissions = new ArrayList<String>();

permissions.add(Manifest.permission.INTERNET);
//permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION); // <--- Add permission here

this.INTLRequestPermission(this, permissions, INTLPermissionRequestCode);
}
Notched screen compatibility settings

After Android P, Android provides a standard API for notched screens.However, for Android O devices, different vendors have different implementation logics.Player Network SDK provides unified C++ API and Java API to support various Android O devices such as Xiaomi, Huawei, Samsung, VIVO, and OPPO.

For Unreal Engine, the game can use UPL to call Java APIs.For more information, refer to Asynchronous Cutout Info Reading.

Generally, the full screen aspect ratio of mobile phones is greater than 2.1.To avoid black borders, users must set android.max_aspect to greater than 2.1.
For Huawei and Xiaomi phones using the Android Oreo operating system, users must configure the AndroidManifest.

To avoid conflicts when merging the AndroidManifest in Unreal Engine 4, go to Project Settings > Android > Max Supported Aspect Ratio and set the maximum supported aspect ratio to 2.4.

Image: Android plugin directory

<androidManifestUpdates>
<log text="INTL-Sample-UPL AndroidManifestUpdates finish" />
<addElements tag="application">
<meta-data android:name="notch.config" android:value="portrait|landscape"/>
<meta-data android:name="android.notch_support" android:value="true"/>
</addElements>
</androidManifestUpdates>

For games that use Android API to obtain notched screen safe area information, please add the following configuration:

Add the following configuration in INTLCore_APL.xml.

INTLCore_APL.xml
<gameActivityImportAdditions>
<insert>

// ... other code

import com.intlgame.core.cutout.DisplayCutoutManager;
import com.intlgame.foundation.Singleton;
</insert>
</gameActivityImportAdditions>
<gameActivityClassAdditions>
<insert>

// ... other code

// Use the cutout area
private void setFullScreen()
{
Log.debug("INTL::setFullScreen");
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);// Set full screen
int 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 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);
}
}
</insert>
</gameActivityClassAdditions>
<gameActivityOnCreateAdditions>
<insert>
setFullScreen();
INTLSDK.initialize(this);

// ...Other game code

// The following uses Android’s native call method
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
getWindow().getDecorView().setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets)
{
Context mContext = getApplicationContext();
DisplayCutoutManager displayCutoutManager = Singleton.getSingleton(DisplayCutoutManager.class);
// Whether the device has a notched display
if (displayCutoutManager.hasCutoutSupport(mContext, insets))
{
// Get notched display safe areas
Rect safeRect = displayCutoutManager.getSafeDisplay(mContext, insets);
// Get notched display notch area
List<Rect> rects = displayCutoutManager.getCutoutSize(mContext, insets);
// Game business logic, can use native call to pass notched display information
}
return insets;
}
});
}
</insert>
</gameActivityOnCreateAdditions>

3. Generate AAR package

Player Network SDK uses Gradle to generate AAR packages.The Gradle configuration files include third-party SDK version numbers as well as the dependencies required by Player Network SDK and third-party channels.Games need to add the necessary dependencies according to the required plug-ins.

The INTLConfig_APL.xml file is the Player Network SDK Gradle configuration file.Update the Gradle configuration according to the game requirements.Replace the {placeholder} text with the values in the INTLConfig.ini configuration file.

<?xml version="1.0" encoding="utf-8"?>

<root xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<init>
<log text="INTLConfig-APL init"/>
</init>

<prebuildCopies>
<log text="INTLConfig-APL Start prebuildCopies ...$S(PluginDir)" />
</prebuildCopies>

<resourceCopies>
<log text="INTLConfig-APL Start resourceCopies...$S(PluginDir)" />
<copyFile src="$S(PluginDir)/../Resources/APASConfig.ini" dst="$S(BuildDir)/assets/APASConfig.ini"/>
<log text="INTLConfig-APL copy APASConfig.ini from $S(PluginDir) to $S(BuildDir) end" />

<setBoolFromProperty result="bEncrypted" ini="Engine" section="/Script/INTLSDK.Settings" property="bEnableConfigIniEncryption" default="false"/>
<if condition="bEncrypted">
<true>
<copyFile src="$S(PluginDir)/../Encrypted/Android/INTLConfig.ini.new" dst="$S(BuildDir)/assets/INTLConfig.ini.new"/>
</true>
<false>
<copyFile src="$S(PluginDir)/../Resources/INTLConfig.ini" dst="$S(BuildDir)/assets/INTLConfig.ini"/>
</false>
</if>
<log text="INTLConfig-APL copy INTLConfig.ini from $S(PluginDir) to $S(BuildDir) end" />
</resourceCopies>


<buildGradleAdditions>
<insert>
<![CDATA[
android{

defaultConfig {
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}',
'WEBVIEW_TASK_AFFINITY' : '',
'DEEPLINK_INTL_SCHEME' : '{INTL_DEEPLINK_INTL_SCHEME}',
'VNG_GG_APP_ID' : '{INTL_VNG_GG_APP_ID}',
'VNG_GG_CLIENT_TOKEN' : '{INTL_VNG_GG_CLIENT_TOKEN}',
]
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
]]>
</insert>
</buildGradleAdditions>

</root>

4. Player Network SDK Configuration

note

When manually modifying the INTLConfig.ini configuration, please contact the Player Network Assistant to confirm whether your changes meet the expected requirements. For details, see SDK Config Notes.

Please configure according to the instructions in INTLConfig.ini.

5. Initialize Player Network SDK

Player Network SDK must be initialized before integrating third-party channels. For more details, see Initialize SDK.For more details, see Initialize SDK.

#include "INTLSDKAPI.h" // Include the INTL header file

void UExample::Init()
{
UINTLSDKAPI::Init();
}

Step 2: Verify successful Player Network SDK integration

  1. 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
  1. Run the program. If the log shows Init INTL SDK success., integration is successful.