Home

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:

  1. Log in to the dashboard with an administrator account.
  2. Add the Nbase SDK to your bundle.gradle or bundle.gradle.kt file.
  3. Copy the downloaded AAR file to your project's Libs directory.
  4. You may use Maven distribution.

Gradle configuration#


_10
dependencies {
_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


_10
dependencies {
_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
}

NameVersionTypeDependeny modules
io.nbase:nbasesdk3.0.38Nbase basic moduleX
io.nbase:nbase-adapter-provider-google3.0.1Google logincom.google.android.gms:play-services-auth:20.7.0
io.nbase:nbase-adapter-provider-apple3.0.1Apple logincom.android.billingclient:billing-ktx:6.1.0
io.nbase:nbase-adapter-provider-facebook3.0.1Facebook login
io.nbase:nbase-adapter-provider-naver3.0.1NAVER login
io.nbase:nbase-adapter-provider-line3.0.1LINE login
io.nbase:nbase-adapter-provider-x3.0.1X login
io.nbase:nbase-adapter-billing-googleplay3.0.1Google Play Store
io.nbase:nbase-adapter-billing-one3.0.1One Store
io.nbase:nbase-adapter-billing-galexy3.0.1Galaxy Store
io.nbase:nbase-adapter-billing-amazon3.0.1Amazon Store

Email and guest logins are included in the basic module.

Pre-requisites#

  1. Project ID and project key can be copied from Dashboard -> Project Settings.
  2. Settings for login, store, and integration are all available in Dashboard -> Project Settings.
  3. For each login method, refer to [Environment Settings by Login Method], add settings to the console, and then add them to the dashboard.
  4. For in-app purchases, add settings to the console and dashboard as per [Store-specific Environment Settings].
  5. 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
}

KeyDescriptionRequired
ProjectIdDashboard -> Project SettingsO
ProjectKeyDashboard -> Project SettingsO
StoreIdRefer to the table belowO
languageLanguages (en,kr,jp...)O
regionRegions (kr, jp, sg, us, eu, preview)O
KeyDescription
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.


_10
NBaseSDK.NBase.signIn(Provider.google.ToString(), (user, error) => {
_10
if (error != null)
_10
{
_10
NBaseSDK.NBase.showToast(error.Message.ToString());
_10
return;
_10
}
_10
}

KeyDescription
Provider.google.ToString()Google
Provider.anonymous.ToString()Guest
Provider.facebook.ToString()Facebook
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.


_10
NBaseSDK.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
});

KeyDescriptionRequired
ProductIdProduct ID (Dashboard -> Payment -> In-app Item)O
MetadataMetadataX
OptionsPayment methodsX
KeyDescription
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