OpenBack Android SDK version 4.1.0
Adding the OpenBack SDK to your Android apps is simple. It should take less than 15 minutes for each app and involves:
- Add 2 lines to your Gradle files
- Update the app manifest file
The SDK is a tiny ~230kB.
For a quick walkthrough of the integration, you can watch our tutorial video below.
A sample application is available on Github.
Migration and Deprecated SDK
If you use any background services, make sure to check the app state before performing processes as the OpenBack SDK frequently runs in the background
1 - Add OpenBack using Gradle
Add OpenBack maven repository to your application build.gradle
Add OpenBack library to your application dependencies
If you prefer to stay up-to-date with new features, you can use the
4.+ notation like this:
2 - Add the App Code to the Manifest
2.1 - Open the Dashboard
If you have already created your app in the dashboard then you can skip to step 2.2
If you have Quick Start enabled, you can quickly create a new app. Add your App Package Name and App Name to the Quick Start section.
After creating your app, you will be brought to the settings page for that app. From here you can copy your App Code and add it to your
2.2 - Adding the App Code to the Manifest
You can find the unique App Code for your application in the Dashboard.
Copy that code for the next step.
If you can't see your app in the App Settings page, make sure you have Demo Mode disabled!
You can configure OpenBack in your application manifest using
meta-data tags inside the
|com.openback.APP_CODE||String||Your application's OpenBack app code.|
|com.openback.AUTO_START||Boolean||If true, OpenBack will start automatically. (Default: true)|
|com.openback.notification.ICON||ResourceID||The resource ID for the notification icon.|
Initialize the OpenBack SDK with your app context
The SDK uses a provider to initialize with the application context automatically. Under certain conditions, some vendors might block execution, resulting in an
IllegalStateException. We recommend calling
initialize() before using OpenBack in your application.
If you do not provide an App Code in the manifest, you can set it using the SDK API.
Check the API Docs for more info.
3 - Add support for Firebase Cloud Messaging
We recommend using FCM but it is not required. See more
3.1 - Firebase Integration
- Go to the Firebase console: https://console.firebase.google.com/.
- Click the cogwheel in the top left of the page and select
- Download the
- Add the JSON file to your Android project
- Add the Google Services plugin at the end of the application
- Add the Firebase Messaging library dependency to your application
For more details, check the official setup guide: https://firebase.google.com/docs/android/setup.
3.2 - Add Firebase Service Handler
The following service is already declared in the library:
If you already have a custom service to handle Firebase Messaging events:
- Make sure the priority is higher than the intent provided by the OpenBack SDK
- Remove the
<service android:name="com.openback.service.OpenBackFirebaseMessagingService">from the manifest
- In your service, call
OpenBackwhen receiving a message or handling a new token:
4 - Verifying the OpenBack Integration
Running your app will register your device as a user to the OpenBack platform. You can verify that this is working by going to the
Verify Latest Installs section within the App Setup tab in your App Settings. If your device has registered, then you are ready to send messages.
When you can see your device registered within this section, follow our guide to create your first push message.
If you use the KeyChain library, make sure to read the FAQ
For integrating features from a previous version of the SDK, click here.
|Signals & Permissions||Add the required settings and permissions in your manifest for signals.|
|Attributes||Attribute values can be set client side by your mobile app, and then used as personalized content within messages.|
|Custom Segments||Custom segments are set client side by your mobile app. They can be used to deliver a message based on the value set in your message campaign which is managed through the OpenBack Dashboard or Client APIs.|
|Goals||Goals can range from anything such as a user completing a signup process, to a user purchasing a product.|
|Events||An event is a user action which is used to deliver a notification. You can pass existing or new events to the OpenBack SDK client-side, making advanced campaigns simple.|
|App Inbox||Deliver & manage messages in an inbox within your app – standalone, or as part of a notification.|
|Topics||Message users that are subscribed to specific topics.|
|Notifications||Customize the appearance of OpenBack notifications.|