แก้ไข

แชร์ผ่าน


Register for Android SDK push notifications using Firebase Cloud Messaging HTTP v1

This article applies to call and chat applications using Android SDK with Firebase Cloud Messaging (FCM) push notification. FCM was previously known as Google Cloud Messaging (GCM/FCM).

On June 20, 2023, Google announced that it deprecated sending messages using the FCM legacy APIs. Google is removing the legacy FCM from service in June 2024. Google recommends migrating from legacy FCM APIs to FCM HTTP v1.

If your existing Android application uses the push notification feature, you need to migrate to the FCM HTTP v1 endpoint.

If you have a new Android application or never used Google FCM, complete the following steps to register for Android SDK push notification using FCM HTTP v1.

Complete the following steps to migrate your push notification to FCM HTTP v1.

1. Generate a private key in Firebase console

  1. Open your project in Firebase console.

  2. Open Project settings > Service accounts.

  3. Select any programming language.

  4. Click Generate new private key to download a JSON file containing your new private key.

    Screenshot of how to generate a new private key for FMC v1 in Firebase console.

  5. Find and open the downloaded JSON file. You need values from this file for the next step.

2. Provide the private key credentials for Google (FCM v1)

  1. Open your Azure Communication Services Notification Hub in the Azure portal.

  2. Open Settings > Google (FCM v1).

  3. Enter the values from your downloaded JSON file in the text boxes for Private Key, Client Email, and Project ID.

    Screenshot of how to provide a new private key credentials for FCM v1 in Azure portal settings.

  4. Click Save.

3. Verify that your application receives push notifications

  1. Wait a few minutes for the changes you made at the Notification Hub to take effect. Your application might experience duplicate push notifications or missed notifications during this time.

  2. Make sure your application receives push notifications without error.

Troubleshooting

If your application can’t receive push notifications, make sure your new FCM v1 credentials are correct. Repeat the steps in this document as needed to Generate a private key in Firebase console or Provide the private key credentials for Google (FCM v1).

If your application still can’t receive push notifications, contact Azure Communication Services at Microsoft Azure Help+ support.

Enable push notifications in your Android chat app Enable push notifications for calls