๐ Getting started¶
Guide and instructions for setting up the Numberly SDK for Android apps
Requirements
compileSdkVersion
30minSdkVersion
16+
1. Install the SDK¶
Add the repository to your project level build.gradle
under allprojects
, or in settings.gradle
under dependencyResolutionManagement
repositories {
[...]
maven {
url "https://numberly.jfrog.io/artifactory/android"
}
}
Add the dependency to your app level build.gradle
file
implementation 'com.numberly:sdk-android:x.x.x'
- Download latest SDK version
- After unarchiving the downloaded
numberly-sdk-android-x.x.x.zip
file, include thesdk-x.x.x.aar
in yourandroid/app/libs
folder. - Make sure your lib folder is included in your app level
build.gradle
with its dependencies
apply plugin: 'kotlin-kapt'
[...]
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar'])
api 'com.google.firebase:firebase-messaging:23.0.0'
api "org.jetbrains.kotlin:kotlin-stdlib:1.4.30"
api 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3'
api 'androidx.lifecycle:lifecycle-extensions:2.2.0'
api 'com.android.volley:volley:1.2.1'
api 'androidx.room:room-runtime:2.4.0'
implementation 'androidx.core:core-ktx:1.7.0'
kapt 'androidx.room:room-compiler:2.4.0'
[...]
}
Important
Download the numberly-sdk-android-x.x.x.zip
not the source code zip.
2. Create and add the configuration file¶
Create the numberly.properties
file in the applicationโs assets folder located at android/app/src/main/assets
app_key=the app key provided by numberly
notification_icon_name=your icon resource name.
Tip
If you need specific configuration for your SDK based on build types or product flavors, just add another numberly.properties
file in the targeted flavor / build type For example: to add specific configuration for an integ
flavor, add the config file to the android/app/src/integ/assets
folder !
Tip
Icon drawables should be inside android/app/res/drawable
. You can create on by right-click on drawable > New > Image Asset > Notification Icons
Options¶
You can customize the configuration with the following properties:
Key | Type | Required | Default | Description |
---|---|---|---|---|
app_key | String | The app key provided by Numberly. | ||
notification_icon_name | String | The icon resource name. It will be the icon used in Android's notification center | ||
notification_icon_color | String | #FFFFFFFF | The icon color in hexadecimal format. Default is white. | |
app_env | String | The app environment (dev, staging, prod...) |
3. Add the Firebase configuration file¶
Important
This guide assumes that you've already configured your android application to connect to Firebase. If this is not the case, please flow this instructions to do so.
Add the google-services.json
file to /android/app
.
4. Start the SDK¶
Here we are! Now you can simply init Numberly
in the Application's onCreate
method
Note
You will need to have a custom Application file for this Follow this guide on how to do so.
override fun onCreate() {
super.onCreate()
Numberly.init(this)
[...]
}
@Override
public void onCreate() {
super.onCreate();
Numberly.init(this);
[...]
}
Troubleshooting¶
If you want to validate your implementation you can active the Numberly logs:
Numberly.setDebugMode(true)
Numberly.setDebugMode(true);
Tips
It's highly recommended to disable logs on production.