Developing the Application
This page refers to Nutaku Unity SDK 3.0.0+. For older versions please consult the page history.
Environment
Quick note about environment aspects for Nutaku Android SDK:
Environment value | Environment of the connection environment | SSL Certificate error handling | Log output |
---|---|---|---|
sandbox | Sandbox environment | they are ignored | Yes |
release | Production environment | not ignored | No |
AndroidManifest.xml
You need to prepare an "AndroidManifest.xml" as shown below to use NutakuAndroidUnitySDK. Place the created AndroidManifest.xml in Android plugin (under Assets/Plugins/Android folder) or in AndroidProject.
The SDK already comes with the file in that location. You may use that as a starting point, if you wish.
Note: do NOT use uppercase characters in your Bundle Identifier (in Unity's Player Settings section), otherwise your login flow of being from the browser back to the app will not work due to an Android limitation!
Make sure your <application> element in AndroidManifest.xml starts off with this definitions, and fill in the appropriate values in the 4 meta-data elements, with your app-specific values ("appId", "consumerKey" and "consumerSecret" are the values you see by opening the game detail page from the developer portal after your game is registered for production or sandbox.)
... <application tools:replace="android:icon" android:name="com.nutaku.unity.NutakuApplication" android:allowBackup="true" android:icon="@drawable/app_icon" android:label="@string/app_name"> <meta-data android:name="sdk_ai" android:value="___SET_THE_APPROPRIATE_VALUE_HERE__AppID___"/> <meta-data android:name="sdk_ck" android:value="___SET_THE_APPROPRIATE_VALUE_HERE__ConsumerKey___"/> <meta-data android:name="sdk_cs" android:value="___SET_THE_APPROPRIATE_VALUE_HERE__ConsumerSecret___"/> <meta-data android:name="sdk_en" android:value="___SET_THE_APPROPRIATE_VALUE_HERE__Environment___"/> <activity android:name="com.nutaku.game.sdk.app.NutakuSplashActivity" android:configChanges="orientation|screenSize" android:theme="@style/AppTheme" android:label="@string/app_name" android:launchMode="singleTask"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name="com.nutaku.unity.UnityPlayerActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen|screenSize" android:label="@string/app_name" android:launchMode="singleTask" android:screenOrientation="portrait"> <meta-data android:name="unityplayer.UnityActivity" android:value="true" /> </activity> </application> ...
Using more recent Unity engine versions
Each SDK is built to be compatible with a specific lowest Unity version in mind. With each version difference between the SDKs compatibility and the Unity version you use, Unity might impose some extra requirements on yourself in order to implement Nutaku Unity SDK.
For example, NutakuUnitySDK 3.0.0 was built to comply with 2018.4 as a minimum. But, if you use, for example, Unity 2020.2, it will complain about a number of different aspects, such as: requires to be run with Administrative privilleges, does not allow specifying minSdkVersion in the manifest, might complain about aaptOptions from mainTemplate.gradle file. You will have to deal with these aspects accordingly.
Logout feature
If you want to offer the user the option to log out (perhaps to change account), you can trigger SdkPlugin.logoutAndExit(). Otherwise, they would have to clear your app data and manually go to nutaku website to log out before re-starting your cleared app.