SDK Integration

Follow the below steps to integrate the Real-time CDP SDK in the Android app:

  1. Add the following codes in your application’s build.gradle.

    1. Append the following dependencies:

      Copy
      dependencies {
      implementation 'com.android.support:cardview­v7:27.1.1­alpha1' 
      implementation 'com.github.bumptech.glide:glide:3.6.1' 
      implementation 'com.google.code.gson:gson:2.4'
      implementation 'com.android.support:recyclerview­v7:27.1.1' 
      implementation 'com.android.volley:volley:1.1.0' 
      implementation 'com.google.firebase:firebase-core:16.0.9'
      implementation 'com.google.firebase:firebase-messaging:18.0.0'
      implementation 'com.google.android.gms:play-services-location:16.0.0'
      implementation 'com.android.support:support­v4:27.1.1'
      }
    2. Append the following code.

      Copy
      android {
          defaultConfig {
              multiDexEnabled true
              }
      }
    3. Append the following code.

      Copy
      apply plugin: 'com.google.gms.google­services'
  2. Add the FCM generated google­services.json file to your project.

    Note: This is required to enable Push Notifications in the app.

  3. Append the following classpath in build.gradle.

    Copy
    buildscript {
        dependencies {
                 classpath ‘com.google.gms:google­services:4.3.3
            }
    }
  4. Append the following code in the manifest.xml file under <application> tag.

    Copy
    <service android:name=“com.manthan.targetone.service.MyFirebaseMessagingService">
        <intent­filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT"/>
        </intent­filter>
    </service>
  5. Add the following permissions in the .manifest file.

    Copy
    <uses­permission android:name="android.permission.INTERNET" />
    <uses­permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses­permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> 
    <usespermission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <usespermission android:name="android.permission.CHANGE_WIFI_STATE"/>
  6. To enable the In-­App Banner Notification feature in your mobile application, add the following code in your manifest file under <application> tag.

    Note: Do not add this code if your app does not use this feature.

    notification_icon – It should be a transparent icon and available in all the Drawables.

    Copy
    <application>
    <meta­data android:name="IN_APP_NOTIFICATION" android:value=“enable"/>
    <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />
    </application>