Android SDK
System requirement#
Minimum requirement: Android level 24 or higher (If you need support for older versions of Android, please contact us.
Installation#
To install the Nbase Android SDK and configure your project, please follow these steps:
- Log in to the dashboard with an administrator account.
- Add the Nbase SDK to your
bundle.gradle
orbundle.gradle.kt
file. - Copy the downloaded AAR file to your project's Libs directory.
- You may use Maven distribution.
Gradle configuration#
_10dependencies {_10..._10 implementation ("com.google.code.gson:gson:2.10")_10 implementation ("io.nbase:nbasesdk:3.0.41")_10..._10}
Examples) Google login and Google Play Store
_10dependencies {_10..._10 implementation ("com.google.code.gson:gson:2.10")_10 implementation ("io.nbase:nbasesdk:3.0.41")_10 implementation("io.nbase:nbase-adapter-provider-google")_10..._10}
Name | Version | Type | Dependeny modules |
---|---|---|---|
io.nbase:nbasesdk | 3.0.38 | Nbase basic module | X |
io.nbase:nbase-adapter-provider-google | 3.0.1 | Google login | com.google.android.gms:play-services-auth:20.7.0 |
io.nbase:nbase-adapter-provider-apple | 3.0.1 | Apple login | com.android.billingclient:billing-ktx:6.1.0 |
io.nbase:nbase-adapter-provider-facebook | 3.0.1 | Facebook login | |
io.nbase:nbase-adapter-provider-naver | 3.0.1 | NAVER login | |
io.nbase:nbase-adapter-provider-line | 3.0.1 | LINE login | |
io.nbase:nbase-adapter-provider-x | 3.0.1 | X login | |
io.nbase:nbase-adapter-billing-googleplay | 3.0.1 | Google Play Store | |
io.nbase:nbase-adapter-billing-one | 3.0.1 | One Store | |
io.nbase:nbase-adapter-billing-galexy | 3.0.1 | Galaxy Store | |
io.nbase:nbase-adapter-billing-amazon | 3.0.1 | Amazon Store |
Email and guest logins are included in the basic module.
Pre-requisites#
Project ID
andproject key
can be copied from Dashboard -> Project Settings.- Settings for login, store, and integration are all available in Dashboard -> Project Settings.
- For each login method, refer to [Environment Settings by Login Method], add settings to the console, and then add them to the dashboard.
- For in-app purchases, add settings to the console and dashboard as per [Store-specific Environment Settings].
- Please register items for each store for in-app purchases under Dashboard -> Payments -> In-App.
Initialization#
To initialize, add the following code to an object used in the first scene loaded when starting the game.
_10 NBase.initialize(activity, projectId, projectKey, [StoreId], [language], [region]) { init, e ->_10 if (e != null) {_10 Log.e("NBase", e.message)_10 } else {_10 Log.e("NBase", init)_10 }_10 }
Key | Description | Required |
---|---|---|
ProjectId | Dashboard -> Project Settings | O |
ProjectKey | Dashboard -> Project Settings | O |
StoreId | Refer to the table below | O |
language | Languages (en,kr,jp...) | O |
region | Regions (kr, jp, sg, us, eu, preview) | O |
Key | Description |
---|---|
Store.google.ToString() | Google Play Store |
Store.one.ToString() | One Store |
Store.galexy.toString() | Galaxy Store |
Store.amazon.toString() | Amazon Store |
Store.huawei.toString() | Huawei Store |
Login#
Use the following code to implement SDK login functionality.
_10NBaseSDK.NBase.signIn(Provider.google.ToString(), (user, error) => {_10 if (error != null)_10 {_10 NBaseSDK.NBase.showToast(error.Message.ToString());_10 return;_10 }_10}
Key | Description |
---|---|
Provider.google.ToString() | |
Provider.anonymous.ToString() | Guest |
Provider.facebook.ToString() | |
Provider.apple.ToString() | Apple |
Provider.naver.ToString() | NAVER |
Provider.kakao.ToString() | Kakao |
Provider.playgame.ToString() | PlayGame |
Provider.steam.ToString() | Steam |
Provider.x.ToString() | X |
Provider.line.ToString() | LINE |
Provider.github.ToString() | GitHub |
Provider.microsoft.ToString() | Microsoft |
Provider.huawei.ToString() | Huawei |
Payment#
Store-specific configuration needs to be completed first. Additionally, if items are not added under Dashboard -> Payments -> In-App, a 'ProductID not found' error will occur.
_10NBaseSDK.NBase.purchase(Store.google.ToString(), [productId], [metadata], [options], (purchase, error) =>_10{_10 if (error != null)_10 {_10 NBaseSDK.NBase.showToast(error.Message.ToString());_10 return;_10 }_10});
Key | Description | Required |
---|---|---|
ProductId | Product ID (Dashboard -> Payment -> In-app Item) | O |
Metadata | Metadata | X |
Options | Payment methods | X |
Key | Description |
---|---|
Store.google.ToString() | Google Play Store |
Store.one.ToString() | One Store |
Store.galexy.toString() | Galaxy Store |
Store.amazon.toString() | Amazon Store |
Store.huawei.toString() | Huawei Store |