Skip to content

Android SDK

Follow the guide below to enter the credentials FlareLane needs to send push notifications.

dependencyResolutionManagement {
repositories {
// Add the line below
maven("https://jitpack.io")
}
}

Add the following to your app-level build.gradle (<project>/<app>/build.gradle).

dependencies {
// Add the line below
implementation("com.github.flarelane:flarelane-android-sdk:1.10.0")
}

In your AndroidManifest.xml file, set android.name=".MainApplication" and use the editor's quick-fix to create the MainApplication class file. You can also create the class file manually.

Android Studio editor with AndroidManifest.xml open and MainApplication class being created

Add the FlareLane.initWithContext function inside the onCreate method. You can find your project ID on the [Project] page in the console.

import com.flarelane.FlareLane
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
// Add the code below
// To control when the notification permission prompt appears, set the third parameter to false and call .subscribe() at the appropriate time.
FlareLane.initWithContext(this, "PROJECT_ID", true)
}
}

When the app is installed, the device created in FlareLane is an "anonymous device." By linking the unique User ID that you manage separately, you can match FlareLane's device to your own User ID.

Linking a User ID has many benefits. It lets you distinguish between members and non-members, and lets you send push notifications by User ID at any time, so we recommend setting it up early in your integration.

Typically, you link the User ID through the setUserId function when a user signs up or logs in successfully.

FlareLane.setUserId(this, "USER_ID")
  • FlareLane offers a variety of convenience features for WebView-based apps so that actions taken on the website can also be recognized in the app. See the WebView-based mobile app bridge guide.
  • By default, FlareLane automatically handles URLs such as https links and deep links when a push notification is clicked. If you need to implement your own click handler, see Disable Automatic URL Handling.
<resources>
<!-- Change the notification color -->
<string name="flarelane_notification_accent_color">#BC0000</string>
</resources>
Guide
Mobile SDK Reference
Android SDK Release Notes