|
| 1 | +--- |
| 2 | +title: Migrate Android SDK push notifications to FCM v1 |
| 3 | +titleSuffix: An Azure Communication Services tutorial |
| 4 | +description: Learn how to migrate Android SDK push notifications from Google Cloud Messaging (GCM/FCM) to Firebase Cloud Messaging (FCM HTTP v1). |
| 5 | +author: jiminwen |
| 6 | +services: azure-communication-services |
| 7 | +ms.author: jiminwen |
| 8 | +ms.date: 05/31/2024 |
| 9 | +ms.topic: tutorial |
| 10 | +ms.service: azure-communication-services |
| 11 | +--- |
| 12 | + |
| 13 | +# Migrate Android SDK push notifications to Firebase Cloud Messaging HTTP v1 |
| 14 | + |
| 15 | +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). |
| 16 | + |
| 17 | +On June 20, 2023, Google announced that it [deprecated sending messages using the FCM legacy APIs](https://firebase.google.com/docs/cloud-messaging). Google is removing the legacy FCM from service in June 2024. Google recommends [migrating from legacy FCM APIs to FCM HTTP v1](https://firebase.google.com/docs/cloud-messaging/migrate-v1). |
| 18 | + |
| 19 | +If you have a new Android application or never used Google FCM, see the [Register for Android SDK push notifications using FCM v1](./call-chat-register-android-push-fcm-v1.md) article. |
| 20 | + |
| 21 | +If your Android application uses the push notification feature, complete the following steps to migrate your push notification to FCM HTTP v1. |
| 22 | + |
| 23 | +## 1. Generate a private key in Firebase console |
| 24 | + |
| 25 | +1. Open your project in [Firebase console](https://console.firebase.google.com/). |
| 26 | + |
| 27 | +2. Open **Project settings** > **Service accounts**. |
| 28 | + |
| 29 | +3. Select any programming language. |
| 30 | + |
| 31 | +4. Click **Generate new private key** to download a JSON file containing your new private key. |
| 32 | + |
| 33 | +  |
| 34 | + |
| 35 | +5. Find and open the downloaded JSON file. You need values from this file for the next step. |
| 36 | + |
| 37 | + |
| 38 | +## 2. Provide the private key credentials for Google (FCM v1) |
| 39 | + |
| 40 | +1. Open your Azure Communication Services Notification Hub in the [Azure portal](https://portal.azure.com). |
| 41 | + |
| 42 | +2. Open **Settings** > **Google (FCM v1)**. |
| 43 | + |
| 44 | +3. Enter the values from your downloaded JSON file in the text boxes for **Private Key**, **Client Email**, and **Project ID**. |
| 45 | + |
| 46 | +  |
| 47 | + |
| 48 | +4. Click **Save**. |
| 49 | + |
| 50 | +## 3. Remove legacy credentials for Google (GCM/FCM) |
| 51 | + |
| 52 | +1. Open your Azure Communication Services Notification Hub in the [Azure portal](https://portal.azure.com). |
| 53 | + |
| 54 | +2. Open **Settings** > **Google (GCM/FCM)**. |
| 55 | + |
| 56 | +3. Clear the **API Key** text box. |
| 57 | + |
| 58 | +  |
| 59 | + |
| 60 | +4. Click **Save**. |
| 61 | + |
| 62 | +## 4. Verify that your application receives push notifications |
| 63 | + |
| 64 | +1. Wait a few minutes for the changes you made at the Notification Hub to take effect. |
| 65 | +Your application might experience duplicate push notifications or missed notifications during this time. |
| 66 | + |
| 67 | +2. Make sure your application receives push notifications without error. |
| 68 | + |
| 69 | + |
| 70 | +## Troubleshooting |
| 71 | + |
| 72 | +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](#1-generate-a-private-key-in-firebase-console) or [Provide the private key credentials for Google (FCM v1)](#2-provide-the-private-key-credentials-for-google-fcm-v1). |
| 73 | + |
| 74 | +If your application still can’t receive push notifications, contact Azure Communication Services at [Microsoft Azure Help+ support](https://ms.portal.azure.com/#view/Microsoft_Azure_Support/HelpAndSupportBlade/~/overview). |
| 75 | + |
| 76 | + |
| 77 | +## Related articles |
| 78 | + |
| 79 | +[Enable push notifications in your Android chat app](./chat-android-push-notification.md) |
| 80 | +[Enable push notifications for calls](../how-tos/calling-sdk/push-notifications.md) |
0 commit comments