Skip to content

DLinkSDK/feature-sdk-kotlin

Repository files navigation

feature-sdk-kotlin

Step 1: Get the Account ID

Register an account at https://console.dlink.cloud/. After creating an app on the platform, get the corresponding Appid of the app.

Step 2: Get the SDK

(1) Configure the Maven repository

repositories {
   maven { url 'https://maven.deeplink.dev/repository/maven-releases/' }
}

Note: The Maven repository address needs to be configured in both 'buildscript' and 'allprojects' in the root directory's 'build.gradle'.

(2) If you are using Gradle for integration, add the following code to your project's build.gradle:

implementation 'dev.deeplink:feature:3.0.6'

Step 3: Configure AndroidManifest

Find the project configuration file AndroidManifest.xml in your project, and add the following permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

If you need to add obfuscation during packaging, please add the following code to the obfuscation configuration file:

-keep class * extends com.google.protobuf.GeneratedMessageLite { *; }
-keep class dev.deeplink.feature.proto.**{*;}

Step 4: Initialize the SDK If your application is in multi-process mode, please initialize the SDK in the main process. Here is the reference code:

class CustomApplication : Application() {

    override fun onCreate() {
        super.onCreate()
        if (baseContext.packageName.equals(packageName)) {
            //[Required] Register an account at https://console.dlink.cloud/. After creating an app on the platform, get the corresponding Appid of the app.
            val accountId = "Account ID from https://console.dlink.cloud"
            //[Required] Device ID in the developer's business system
            val deviceId = "ABCD-EFGH-IJKL-MNOP"

            //[Optional] If the developer wants to obtain feature data by themselves,
            // they can deploy a server to receive data and pass the server address to the SDK.
            val serverUrl = "https://xxx.xxx"

            //Please call the SDK initialization method in the thread.
            //Time-consuming operations will be performed during initialization.
            Thread {
                FeatureSdk.launch(
                    this,
                    FeatureConfig(appId = accountId, deviceId = deviceId, apiBaseUrl = serverUrl)
                )
            }.start()
        }
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages