Nudges - Integrating the SDK
Important
Nudge SDK is available for integration from Smartech SDK v3.1.0 onwards.
1. Create the App from Hansel Dashboard
Please get in touch with your account manager to create app on Hansel dashboard.
2. Adding Dependencies
To install the latest Nudge SDK in your project, add the following line to the dependencies section in the app-level build.gradle
implementation 'com.netcore.android:smartech-sdk:3.1.1'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61'
implementation 'androidx.work:work-runtime-ktx:2.3.3'
implementation 'com.netcore.android:smartech-nudges:8.5.1'
Perform gradle sync
Be sure to perform a Gradle Sync to build your project and incorporate the dependency additions noted above.
3. Add Hansel App ID and Hansel App Key
Add the following lines in AndroidManifest.xml. Replace <hansel_app_id> and <hansel_app_key> with values you get from the Setting section on the Hansel dashboard.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="<package-name>">
<application>
...
<meta-data
android:name="HANSEL_APP_ID"
android:value="<hansel_app_id>" />
<meta-data
android:name="HANSEL_APP_KEY"
android:value="<hansel_app_key>" />
...
</application>
</manifest>
4. Setting up proguard rules
Add the following lines in proguard-rules.pro to retain Hansel files during the proguard process.
-dontwarn io.hansel.**
-keep class io.hansel.**{*;}
-keep class * implements io.hansel.**.* {*;}
-keep class * extends io.hansel.**.* {*;}
Updated over 3 years ago