Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Getting started

You are currently viewing the AWS SDK for Mobile documentation which is a collection of low-level libraries. Use the Amplify libraries for all new app development. Learn more

Enable your users to receive mobile push messages sent from the Apple (APNs) and Google (FCM/GCM) platforms. The CLI deploys your push notification backend using Amazon Pinpoint. You can also create Amazon Pinpoint campaigns that tie user behavior to push or other forms of messaging.

Set Up Your Backend

  1. Complete the Get Started steps before you proceed.

  2. Use the CLI to add storage to your cloud-enabled backend and app.

    In a terminal window, navigate to your project folder (the folder that typically contains your project level build.gradle), and add the SDK to your app.

    amplify add notifications
  3. Set up your backend to support receiving push notifications:

    • Choose Firebase Cloud Messaging (FCM).

      > FCM
    • Provide your Server Key. For information on getting an FCM Server Key, see the section Setting Up FCM/GCM Guide. Use the steps in the next section to connect your app to your backend.

Connect to Your Backend

Use the following steps to connect your app to the push notification backend services.

  1. Add the following dependencies and plugin to your app/build.gradle:

    dependencies {
    // Overrides an auth dependency to ensure correct behavior
    implementation ''
    // Import the BoM for the Firebase platform
    implementation platform('')
    implementation ''
    implementation 'com.amazonaws:aws-android-sdk-pinpoint:ANDROID_SDK_VERSION'
    implementation 'com.amazonaws:aws-android-sdk-mobile-client:ANDROID_SDK_VERSION'
    apply plugin: ''
  2. Add the following to your project level build.gradle. Make sure that you specify the google repository:

    buildscript {
    dependencies {
    classpath ''
    allprojects {
    repositories {
  3. AndroidManifest.xml must contain the definition of the following service for PushListenerService in the application tag:

    <action android:name=""/>
  4. Create the Amazon Pinpoint client in your custom Application class. This is necessary to ensure Pinpoint is initialized before the push notification Intent is handled.

    import android.content.Context;
    import android.util.Log;
    import com.amazonaws.mobileconnectors.pinpoint.PinpointConfiguration;
    import com.amazonaws.mobileconnectors.pinpoint.PinpointManager;
    public class MyPinpointApp extends Application {
    public static final String TAG = MyPinpointApp.class.getSimpleName();
    private static PinpointManager pinpointManager;
    public void onCreate() {
    // Initialize PinpointManager
    public static PinpointManager getPinpointManager(final Context applicationContext) {
    if (pinpointManager == null) {
    final AWSConfiguration awsConfig = new AWSConfiguration(applicationContext);
    AWSMobileClient.getInstance().initialize(applicationContext, awsConfig, new Callback<UserStateDetails>() {
    public void onResult(UserStateDetails userStateDetails) {
    Log.i("INIT", "User State: " + userStateDetails.getUserState());
    public void onError(Exception e) {
    Log.e("INIT", "Initialization error.", e);
    PinpointConfiguration pinpointConfig = new PinpointConfiguration(
    pinpointManager = new PinpointManager(pinpointConfig);
    .addOnCompleteListener(new OnCompleteListener<String>() {
    public void onComplete(@NonNull Task<String> task) {
    if (!task.isSuccessful()) {
    Log.w(TAG, "Fetching FCM registration token failed", task.getException());
    final String token = task.getResult();
    Log.d(TAG, "Registering push notifications token: " + token);
    return pinpointManager;
  5. Next, configure your application to use your custom Application class. Open the AndroidManifest.xml file located in your project directory at app/src/main/AndroidManifest.xml.

    Add the android:name attribute to the application node. For example, if the application name is MyPinpointApp and the new class is named MyPinpointApplication, the update to the AndroidManifest.xml file looks as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android=""
    <!-- Add the android:name attribute to the application node -->