To integrate the Marketing Cloud Mobile Push Android SDK with your Android mobile app, register a device with Marketing Cloud. To register a device, add the SDK and its dependencies to your app by following these instructions.

Prerequisites

Create an app in MobilePush. This process connects the device to the MobilePush app you created previously in MobilePush.

The Android SDK requires Android API 16 or greater and has dependencies on the Android Support v4 and Google Play Services libraries.

1. Implement the SDK

Update module-level build.gradle file

Add the SDK repository:

Add the SDK dependency:

Replace {currentVersion} with 6.0.2 to use the latest SDK version.

The SDK no longer declares the Google Play Services Location or AltBeacon libraries as required dependencies. Follow the instructions for enabling Geofence and Beacon messaging if your application requires these features.

2. Set up Firebase

Follow the Android Firebase setup documentation.

If you initialize the FirebaseApp manually, you must initialize Firebase before initializing the SDK.

3. Initialize the SDK

The SDK must be initialized during the execution of your Application class’s onCreate method. Initialization will require configuration data for your Marketing Cloud Application. Please refer to the documentation for guidance on where to find the required pieces of data.

If you don’t call the SDK’s init method from your app’s onCreate, the SDK can’t post notifications while the app is in the background.

To troubleshoot information the InitializationStatus returned during the SDK’s initialization call, see Initialization Status in the troubleshooting section for more details.

You can customize the display and handling of notifications. See the customize notifications documentation for details.

4. Send a test push notification

Send a test push notification from the Marketing Cloud to your app.


To upgrade from a previous version, see the upgrading documentation.