---
schema_version: "1"
id: 9afd71396d041e4f16971c448d0971bd804071d3d8b5330458ee7d988fee48b0
title: Push Notifications with the Service Chat SDK for Android
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/service-sdk-android/guides/android-push-notifications.md
canonical_url: https://developer.salesforce.com/docs/service/service-sdk-android/guide/android-push-notifications.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 46d6a8c17a804042be2b52a4e94e7f01a50a5bb9ac9060af086230bc30773c37
products:
  - Embedded Service Chat SDK for Android Developer Guide
  - Service Cloud Developer Content
---

# Push Notifications with the Service Chat SDK for Android

To take advantage of push notifications from your org to your app, set up an Apex trigger and configure your app for notifications. Pass relevant notification information, such as case feed activity, to the Service Chat SDK using your `PushNotificationListener` implementation.

**important:** The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5) before that date. Messaging offers many of the [chat features](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5) that you love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1).

The following activities can cause notifications:

- Agent has connected
- Agent sent a message
- Agent requested a file transfer
- Agent canceled a file transfer
- Agent ended a session

To implement notifications, follow these steps:

1.  Set up authentication in your app. To learn more, see [Authentication with the Service Chat SDK for Android](https://developer.salesforce.com/docs/service/service-sdk-android/guide/android-authentication.md).

2.  Add FCM (Firebase Cloud Messaging) to your app. To learn more, see Google's documentation, [Add Firebase to Your Android Project](https://firebase.google.com/docs/android/setup).

    **note:** Avoid any references to GCM (Google Cloud Messaging) in your build dependencies and your `AndroidManifest.xml` files. If you experience a `NoClassDefError` which claims that `GcmReceiver` is missing, it may be included in your final merged manifest by one of your dependencies, such as the Salesforce Mobile SDK. To resolve the error, add the following remove instruction to your `AndroidManifest.xml`: `<receiver android:name="com.google.android.gms.gcm.GcmReceiver" tools:node="remove"/>`.

3.  Add a `connected-app` dependency in your module's `build.gradle` file.

    Service Chat SDK

    ```java
    dependencies {

      // Add the connected-app dependency
      implementation "com.salesforce.service:connected-app:8.0.6"

      // ... your other dependencies go here too ...
    }
    ```

    **note:** The version of the connected-app is the same as the version of the Common module used by the Service Chat SDK.

4.  Create a connected app and an Apex trigger to send a notification from your org. Follow the instructions in the [Salesforce Mobile Push Notifications Implementation Guide](https://developer.salesforce.com/docs/atlas.en-us.pushImplGuide.meta/pushImplGuide/pns_overview.htm) for [Creating a Connected App](https://developer.salesforce.com/docs/atlas.en-us.pushImplGuide.meta/pushImplGuide/pns_create_connected_app_overview.htm).

5.  Implement [`PushNotificationListener`](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/connectedapp/PushNotificationListener.html) and handle the push notification event in the [`onPushNotificationReceived`](https://developer.salesforce.com/docs/service/service-sdk-android/guide/%3Chttps://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/connectedapp/PushNotificationListener.html#onPushNotificationReceived(android.os.Bundle)>) method.

6.  Configure using the Sender ID, [`AuthTokenProvider`](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/service/common/http/AuthTokenProvider.html), and the site URL.

    Pass this object your push notification listener and then register your device for push notifications.

    In Java:

    ```java
    // Create a connected app object
    SalesforceConnectedApp connectedApp =
      SalesforceConnectedApp.create(this, new ConnectedAppConfiguration.Builder()
        .gcmSenderId(uniqueProjectId)
        .salesforceInstanceURL(siteUrl)
        .authTokenProvider(authProvider)
        .build());

    // Add the push notification listener
    connectedApp.addPushNotificationListener(myPushNotificationListener);

    // Register for push notifications
    connectedApp.registerDeviceForPushNotifications().onError(new Async.ErrorHandler() {
      @Override public void handleError (Async<?> operation, @NonNull Throwable throwable) {
        // TO DO: Handle error
      }
    });
    ```

    In Kotlin:

    ```java
    // Create a connected app object
    val connectedApp = SalesforceConnectedApp.create(this, ConnectedAppConfiguration.Builder()
        .gcmSenderId(uniqueProjectId)
        .salesforceInstanceURL(siteUrl)
        .authTokenProvider(authProvider)
        .build())

    // Add the push notification listener
    connectedApp.addPushNotificationListener(myPushNotificationListener)

    // Register for push notifications
    connectedApp.registerDeviceForPushNotifications().onError(object: Async.ErrorHandler {
      override fun handleError(operation: Async<*>?, throwable: Throwable) {
        // TO DO: Handle error
      }
    })
    ```
