To integrate the Marketing Cloud Mobile Push Android SDK with your Mobile Android App, you will need to register a device with the Marketing Cloud. To do this you must add the SDK and its dependencies to your application. The following steps will guide you through the process.

This process connects the device to the MobilePush app you created previously in the APP CENTER. If you have not completed these steps please do so now.

NOTE: The Marketing Cloud Mobile Push Android SDK requires Android API 15 (aka Ice Cream Sandwich or Android v4.0.3) or greater and has dependencies on the Android Support v4 and Google Play Services libraries. Android API 23 (aka Marshmallow or Android v6.0) and the new Android Permissions model is supported.

NOTE: Google discontinued Eclipse support, and the Marketing Cloud deprecated Eclipse usage in the Journey Builder for Apps SDK. Move to Android Studio as soon as possible to ensure compatibility with future releases.

Integrating via Android Studio

Update Your Project’s build.gradle

Add the following repositories to your application’s build.gradle file.

Update Your Project’s app\build.gradle

Add an Application ID

Add an applicationId to the defaultConfig{ } section. This is required for the manifest merger process to work and have the appropriate permissions and intent-filters assigned to your application.

Add the SDK’s Dependencies

Add the following dependencies to your application app\build.gradle file.

Update Your Project’s AndroidManifest.xml

Your manifest must contain a named application and have a class that extends Android Application. This is accomplished by adding an android:name field to the <application> tag.

NOTE: As of v4.2 of the Marketing Cloud Mobile Push Android SDK, you no longer have to explicitly declare the permissions, activities, receivers and services required by the SDK. A manifest is provided in the AAR and Android’s build tools will automatically merge the manifests. You should remove any previously included statements in your manifest to avoid conflicts.

Configure the SDK

In your Android Application Class’ onCreate() method you will need to configure the SDK with a call to configureSdk():

NOTE: configureSdk() must be called from your Application Class to ensure that background receivers and services can be initialized properly. Failing to do so will result in 1) your application failing to receive background push notifications, location updates, etc. and 2) potentially crashes.

NOTE: Changes, including your initial registration from a device, propagate from the server every 5 minutes. Ensure you wait an appropriate amount of time before expecting to receive push notifications or for changes to take affect.

Success!

You should now be able to send a push notification from the Marketing Cloud to your application!


Upgrading From Previous Versions

Please see the Upgrading section HERE