Setup with FCM (v1.1.8.fcm or older)

Integrating the Blueshift Android SDK to your app is pretty simple and straight forward. All you need to do is to follow the steps given below one-by-one.

  1. Add Firebase to your App
  2. Get the Blueshift Android SDK
  3. Update AndroidManifest file
  4. Initialize the Blueshift SDK
  5. Setting user info
  6. Proguard Rules

Blueshift SDK uses FCM to deliver push messages to your app. Before starting the Blueshift Android SDK integration, you need to Add Firebase to Your App.


1. From jCenter

Update your build.gradle file with any one of the following two code snippets to get the SDK from jCenter.

// #1

dependencies {
    // BlueShift SDK
    compile('com.blueshift:android-sdk:1.1.0') { transitive = true }
// #2

dependencies {
    // for Android Advertising Id
    compile ''
    // for FCM Messaging
    compile ''
    // for JSON parsing
    compile ''
    // for annotations used (ex @NotNull)
    compile 'org.jetbrains:annotations:13.0'

    // BlueShift SDK
    compile 'com.blueshift:android-sdk:1.1.0'

2. Using .AAR file

  1. Download the latest version of blueshift-android-sdk file from here
  2. Add it into your /libs folder.
  3. Modify your build.gradle file to contain following code.
repositories {
    flatDir {
        dirs 'libs'

dependencies {
    // for Android Advertising Id
    compile ''
    // for FCM Messaging
    compile ''
    // for JSON parsing
    compile ''
    // for annotations used (ex @NotNull)
    compile 'org.jetbrains:annotations:13.0'

    // BlueShift SDK
    compile(name: 'blueshift-android-sdk-1.1.0', ext: 'aar')

3. Add as module

The sdk can be integrated into your application using simple steps.

  1. Clone this project into your machine
  2. Add this project as a library module

Add the following permissions to your AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />

<!-- For scheduling network operations effectively -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<!-- For analytical purpose -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Add the following block inside <application> tag to enable deep-linking from notification clicks.

<receiver android:name="com.blueshift.rich_push.RichPushActionReceiver">
    <!-- Important: Replace 'com.blueshift.sampleapp' with your app's package name -->
        <action android:name="com.blueshift.sampleapp.ACTION_VIEW" />
        <action android:name="com.blueshift.sampleapp.ACTION_BUY" />
        <action android:name="com.blueshift.sampleapp.ACTION_OPEN_CART" />
        <action android:name="com.blueshift.sampleapp.ACTION_OPEN_OFFER_PAGE" />
        <action android:name="com.blueshift.sampleapp.ACTION_OPEN_APP" />

        <category android:name="com.blueshift.sampleapp" />

To initialize the SDK, add the following code inside onCreate() of your Application file.

Configuration configuration = new Configuration();

// == Mandatory Settings ==

// == Deeplink (Optional) ==

// == Notification (Optional) ==
int color = ContextCompat.getColor(getApplicationContext(), R.color.notification_color);
configuration.setDialogTheme(; // for dialog type notifications

// == Batched Events (Optional) ==
 * This is the time interval used for batching events which are then sent to
 * Blueshift using the bulk events api call. It defaults to 30 min if not set.
 * It is recommended to use one of the following for API < 19 devices.
 * AlarmManager.INTERVAL_HOUR
 * AlarmManager.INTERVAL_DAY


Learn more about Batch and Real-time events here

The UserInfo class helps sending the user related details to Blueshift. If the values are set after sign in, they will be used for building the events params for all events going forward. Here is an example of setting customer id and email after user sign in.

// sign in complete
UserInfo userInfo = UserInfo.getInstance(this);
// It is important to save the instance once an updation is made on UserInfo;

Add the following lines to your file to exclude the Blueshift Android SDK

-keep class com.blueshift.** { *; }
-dontwarn com.blueshift.**

That's it! You are all set to start using the sdk!

Next step is to start Tracking Events

Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.