Installation
This guide will walk you through the process of installing the Nudge SDK in your Android application.
Latest Version:
Pre Requisites
info
- Minimum SDK Supported :
21+
- Minimum Kotlin Version :
1.7+
- Compile SDK Version :
34+
- Android Gradle Plugin :
7.2.0+
Installing the package
To integrate the nudge_android_v2
SDK into your Android application, follow these steps:
1. Configure settings.gradle
Add the following repository to your settings.gradle file to download the Nudge SDK:
- Groovy
- Kotlin(DSL)
dependencyResolutionManagement {
repositories {
maven {
url "https://github.com/nudgenow/android/raw/prod_main/release/"
}
}
}
dependencyResolutionManagement {
repositories {
maven("https://github.com/nudgenow/android/raw/prod_main/release/")
}
}
2. Add Plugin to build.gradle (Project-Level)
Ensure you have the Kotlin Android plugin in your project-level build.gradle:
- Groovy
- Kotlin(DSL)
plugins {
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}
plugins {
id("org.jetbrains.kotlin.android") version "1.7.10" apply false
}
3. Add SDK Dependency to build.gradle (App-Level)
Import the nudge_android_v2 SDK module-wide in your app-level build.gradle:
- Groovy
- Kotlin(DSL)
dependencies {
implementation "com.nudgenow.nudge_android:nudge_android_v2:latest_version"
}
dependencies {
implementation("com.nudgenow.nudge_android:nudge_android_v2:latest_version")
}
4. Final Steps
Sync Gradle: After adding the dependencies, sync your project in Android Studio.
Initialization
Initialize NudgeCore
in onCreate().
- Kotlin
- Java
import com.nudgenow.nudgecorev2.core.NudgeInitialise
class YourApplication : Application() {
override fun onCreate() {
super.onCreate()
NudgeCore.initialize(
application = this, // Context of Your Application
apiKey = "YOUR API KEY",
debugMode = true, // THIS WILL ENABLE Nudge's Log to get printed
region = Region.IN or Region.US
)
}
}
import com.nudgenow.nudgecorev2.core.NudgeCore;
public class YourApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
NudgeCore.initialize(
this, // Context of Your Application
"YOUR API KEY",
true, // THIS WILL ENABLE Nudge's Log to get printed
Region.IN or Region.US
);
}
}
warning
Configure Proguard Rules
Add the below rule to your proguard rules
-keep class com.nudgenow.** { *; }