Documentation
Website
  • Getting Started
  • Customer Journey
    • Creating Customer Journey
    • Understanding the Journey
    • Performance Dashboard
    • Pre-built Templates
  • Channels
    • Mobile Push
    • Web Push
    • In-App Message
    • SMS/LMS
    • Webhook
  • Audience
    • Segments
    • Device Management
  • Engagement Tools
    • Dashboard
    • Message Personalization (Liquid)
    • Template
    • Sending Test Messages
    • AI Messaging
    • API Templates
    • Rate Limiting
    • Frequency Capping
    • Tracking Events
    • Inviting Members
  • Data Integration
    • User ID
    • Events
    • Tags
    • Integrating Google Tag Manager
    • Integrating Amplitude
    • Integrating Mixpanel
  • Guide for Developers
    • Mobile SDK Setup
      • Android SDK Setup
      • iOS SDK Setup
      • React Native SDK Setup
      • Flutter SDK Setup
      • Additional Setup
        • Android: FCM Setup (v1)
        • Android: Notification Icons
        • iOS: APNS Setup
        • iOS: Disable Swizzling
    • Web SDK Setup
    • REST API Reference
    • Mobile SDK Reference
    • Web SDK Reference
Powered by GitBook
On this page
  • 1. Requirements
  • 2. Credentials Setup
  • 3. Install SDK using Gradle
  • 4. Initialization
  • 5. Test
  • 6. Identify your user
  • 7. Additional Setup
  • Resources
  1. Guide for Developers
  2. Mobile SDK Setup

Android SDK Setup

PreviousMobile SDK SetupNextiOS SDK Setup

Last updated 2 days ago

1. Requirements

  • to FlareLane and create a project


2. Credentials Setup

Follow this guide below:

  • Android: FCM Setup (v1)


3. Install SDK using Gradle

Add the Gradle repository. Enter the following values ​​inside the repositories block:

Where is the repositories block in your project?

For a project created through the latest Android Studio, it is located in settings.gradle -> dependencyResolutionManagement.

For others, build.gradle -> allprojects.

dependencyResolutionManagement {
  repositories {
    // Add the code below
    maven { url 'https://jitpack.io' }
  }
}
allprojects {
  repositories {
    // Add code below
    maven { url 'https://jitpack.io' }
  }
}

Open your App level build.gradle(<project>/<app>/build.gradle), add the SDK and click Sync Now to get up to date.

dependencies {
  // Add the code below
  implementation 'com.github.flarelane:FlareLane-Android-SDK:1.8.3'
}

4. Initialization

Add initialization code to onCreate of Application Class (not Activity). Start by creating an Application Class first, and if you already have an Application Class, you can skip this process.

Enter android.name=".MainApplication" in the AndroidManifest.xml file and generate the MainApplication class file through the editor helper. You can also create this file manually.

Add the following code to onCreate. You can check your project ID at FlareLane console's Project.

import com.flarelane.FlareLane

class MainApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        
        // Add the code below
        // To subscribe later, set the 3rd parameter to false and then run the .subscribe() later.
        FlareLane.initWithContext(this, "INPUT_YOUR_PROJECT_ID", true)
    }
}
import com.flarelane.FlareLane;

public class MainApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        
        // Add the code below
        // To subscribe later, set the 3rd parameter to false and then run the .subscribe() later
        FlareLane.initWithContext(this, "INPUT_YOUR_PROJECT_ID", true);
    }
}

5. Test

After completing all the steps, build and run your app. Devices that subscribe to push notifications will be automatically added to FlareLane console's All Devices.

Before actual deployment, be sure to verify that the push notifications are being received properly on the device and that the statistics are accurately recorded when the push notifications are clicked.


6. Identify your user

FlareLane's device is 'anonymous' and you can match the device with your user based on the unique user ID that identifies your user.

Usually, when a user sign-up or log-in, you should execute setUserId.

FlareLane.setUserId(this, "USER_ID")
FlareLane.setUserId(this, "USER_ID");

7. Additional Setup

To set a accent color or channel name, add the following lines:

<resources>
    <!-- accent color  -->
    <string name="flarelane_notification_accent_color">#BC0000</string>
    <!-- channel name -->
    <string name="flarelane_default_channel_name">All Notifications</string>
</resources>

To customize notification icons, see below:

  • Android: Notification Icons

To use Journeys or Message Personalization, integrate custom data via SDK or API:

  • Data Integration


Resources

Mobile SDK Reference

Setting up has many benefits. You can distinguish whether a user has signed-up, and push notifications can be sent based on the User ID.

Sign up
User ID