Basic Setup

👍

UPDATE!

We have updated our release process for SDK 2, 3 & Product Experience starting 12th April 2021! Please follow the new guidelines as mentioned below.

To integrate your Android project with Smartech Android SDK, follow these steps

📘

Android Project Prerequisites:

  • Target API level 19 or later
  • Use Gradle 4.1 or later

Step 1: Integrate the latest Smartech SDK

  1. Make the following changes in the app-level build.gradle
apply plugin: 'com.android.application'

android {
    ...
    defaultConfig { ... }
    buildTypes {
        ...
    }
}

repositories {
    maven { url 'https://artifacts.netcore.co.in/artifactory/android' }
}

dependencies {
implementation 'com.netcore.android:smartech-sdk:3.2.30'
// WorkManager Version 2.7.0 is required for apps targeting Android 12 (S), uncomment the below line based on the app side requirement

// (Java only enable below)
 // implementation 'androidx.work:work-runtime:2.7.0'

// Kotlin + coroutines enable below
 // implementation 'androidx.work:work-runtime-ktx:2.7.0'
}

buildscript {
}

📘

Note

  1. WorkManager Version 2.7.0 is required for apps targeting Android 12 (S).

  2. Perform Gradle Sync to build your project and incorporate the dependency additions noted above.

Step 2: Initialize Smartech SDK

  1. Put your Smartech panel's app Id in the meta-data tag of your application's manifest file, it should be added within the application tag, but outside of any component within the application tag.
    To get Smartech App ID, follow steps given here , else please get in touch with your account manager to get the value of SMT_APP_ID
<meta-data
   android:name="SMT_APP_ID"
   android:value="YOUR_SMARTECH_APP_ID_HERE" />

🚧

Note

Please make sure you enter your own Smartech App ID in the code snippet before putting it in the meta-data tag of your application's manifest file.

  1. Add the below mentioned code in the onCreate() method of your Application class to initialize the Smartech SDK.
@Override
public void onCreate() {
    super.onCreate();
    Smartech.getInstance(new WeakReference<>(context)).initializeSdk(this);
}
override fun onCreate() {
    super.onCreate()
    Smartech.getInstance(WeakReference(applicationContext)).initializeSdk(this)
}
  1. Make sure you have registered your Application class in the Application tag inside the manifest.xml file.

Step 3: Setting up Proguard rules

Add the following lines in proguard-rules.pro to retain Smartech SDK files during the proguard process.

# Smartech Base SDK
-dontwarn com.netcore.android.**
-keep class com.netcore.android.**{*;}
-keep class * implements com.netcore.android.**.* {*;}
-keep class * extends com.netcore.android.**.* {*;}

Step 4: Choose Features

Now that the basic setup is completed, you can choose to move to either of below features:

  1. Customer Engagement Channels like Push Notifications & In-app Messages
  2. User & Event Tracking
  3. Product Experience