Step 3: Notivera Android SDK Integration

Before you start

Please ensure the previous steps were completed and keep the following items handy to start with the SDK integration

📘 1. API Key

  1. API Secret
  2. TenantID
  3. google-services.json

Add Firebase config to your project

[block:image] { “images”: [ { “image”: [ “https://files.readme.io/c6831bf-image.png”, null, “” ], “align”: “center”, “sizing”: “70%”, “border”: true } ] } [/block]

Integration

  1. Add Notivera sdk to your project. Add the Jitpack publishing url to the repositories block of your gradle file depending upon your needs,
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            ...
            maven { url "https://jitpack.io" }
        }
}
plugins {
    id 'com.google.gms.google-services'version 'version number' apply false
}
 plugins {
    id 'com.google.gms.google-services'
}
  1. Add NotiveraSDK dependency in your app level build.gradle by choosing the latest version from jitpack

dependencies {
    implementation 'com.github.Notivera:android-sdk:5.0.0'
}

❗️ If you’re using Proguard

Please add -keep class com.notivera.** { *; } to your ProGuard rules file. if not the device will not register itself or appear in the Notivera portal.

Troubleshooting

if you experience some troubles with Proguard in Release mode then in gradle.properties add option android.enableR8.fullMode=false

  1. Since this SDK uses Firebase Cloud Messaging (FCM) for push notifications, initialise the Firebase SDK if you have not already initialised. See Setup FCM Client Android App
  2. Initialise the NotiveraSDK inside the Application class.
class MyApplication: Application() {

  override fun onCreate() {
        super.onCreate()
        initSDK()
  }

  private fun initPushSDK() {
        FirebaseApp.initializeApp(this)
        SDK.init(
            application = this,
            SDKConfig(
                apiKey = <API KEY>,
                apiSecret = <API SECRET>,
                tenantID = <YOUR TENANT ID>, (Optional field)
                enableDebug = true,
                appVersion = <APP VERSION>,(Optional field)
                enableGeofence = true,
                customerId = <YOUR CUSTOMER ID>,(Optional field)
                trackLocation = true,
                inAppOpenDelay = <DELAY IN MILLISECONDS>, (Optional field)
                downloadConnectionType = ConnectionType.WIFI,
                activeGeofenceLimit = 20 (Optional field)
            ),
           //Optional
            NotiveraPushTheme(
                largeIconRes = <LARGE NOTIFICATION ICON>,
                smallIconRes = <SMALL NOTIFICATION ICON>,
                color = R.color.black
            )
        )
  }
}