From 39c2242d14effda9e6404b99e0fc10bd09026b0f Mon Sep 17 00:00:00 2001 From: tjroach Date: Wed, 19 Jun 2024 15:04:28 -0400 Subject: [PATCH] Update fcm setup instructions --- .../getting_started/fcm-cli-resources.mdx | 2 +- .../android/setup_push_service/setup-fcm.mdx | 16 +++++----------- .../common/getting_started/getting-started.mdx | 2 +- .../getting_started/fcm-cli-resources.mdx | 2 +- .../android/setup_push_service/setup-fcm.mdx | 18 ++++++------------ .../common/getting_started/getting-started.mdx | 2 +- .../android/getting-started.mdx | 8 +++++++- .../push-notifications/android/setup-fcm.mdx | 12 +++++++----- 8 files changed, 29 insertions(+), 33 deletions(-) diff --git a/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-cli-resources.mdx b/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-cli-resources.mdx index 2a42b844f3e..39c3077b6d5 100644 --- a/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-cli-resources.mdx +++ b/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-cli-resources.mdx @@ -16,4 +16,4 @@ Choose _FCM_ when promoted: ``` -The CLI will prompt for your _Server Key_, paste the **Token** you copied while [setting up push notification services](/gen1/[platform]/prev/build-a-backend/push-notifications/set-up-push-service/). +The CLI will prompt for your _service account key (json file) path_ created from steps in [setting up push notification services](/gen1/[platform]/prev/build-a-backend/push-notifications/set-up-push-service/). Enter the absolute path, or a path relative to the location where you ran the command. diff --git a/src/fragments/lib-v1/push-notifications/android/setup_push_service/setup-fcm.mdx b/src/fragments/lib-v1/push-notifications/android/setup_push_service/setup-fcm.mdx index 155f8dc74df..d3f1c3ba73e 100644 --- a/src/fragments/lib-v1/push-notifications/android/setup_push_service/setup-fcm.mdx +++ b/src/fragments/lib-v1/push-notifications/android/setup_push_service/setup-fcm.mdx @@ -6,7 +6,7 @@ Push notifications for Android apps are sent using Firebase Cloud Messaging (FCM - [Register your app with Firebase](https://firebase.google.com/docs/cloud-messaging/android/first-message#register_your_app_with_firebase) - [Add a Firebase configuration file](https://firebase.google.com/docs/cloud-messaging/android/first-message#add_a_firebase_configuration_file) -Next, you will need to access your **ServerKey** (Referred to as **ApiKey** in the CLI setup): +Next, you will need to create your service account key (json file): - Open the [Firebase console](https://console.firebase.google.com/). - Choose your Firebase project. @@ -14,15 +14,9 @@ Next, you will need to access your **ServerKey** (Referred to as **ApiKey** in t ![image](/images/push-notifications/setup-fcm/project-settings.png) -- Select the **Cloud Messaging** tab. -- Select the three vertical dots next to **Cloud Messaging API (Legacy)**, then select **Manage API in Google Cloud Console**. ![The three dot menu button is circled in the cloud messaging tab.](/images/push-notifications/firebaseconsole.png) - -![image](/images/push-notifications/setup-fcm/manage-api.png) - -- In the new tab, select the **Enable** button. -- Return to the previous page and refresh it. -- Copy the **Server key** token - -![image](/images/push-notifications/setup-fcm/server-id.png) +- Select the **Service accounts** tab. +- Select **Firebase Admin SDK** in the sidebar +- Click **Generate new private key** +- Keep the downloaded service account key (json file) safe. You will need to provide the path to the CLI. Return to [Provisioning resources through CLI](/gen1/[platform]/prev/build-a-backend/push-notifications/set-up-push-notifications/#provisioning-resources-through-cli) with the copied **Token** diff --git a/src/fragments/lib-v1/push-notifications/common/getting_started/getting-started.mdx b/src/fragments/lib-v1/push-notifications/common/getting_started/getting-started.mdx index da8e0de1ea3..ac45d1f1a48 100644 --- a/src/fragments/lib-v1/push-notifications/common/getting_started/getting-started.mdx +++ b/src/fragments/lib-v1/push-notifications/common/getting_started/getting-started.mdx @@ -26,7 +26,7 @@ To use Push Notifications with Amplify, you have the option to either have the A -Push Notifications requires version **10.8.0+** of the Amplify CLI. You can check your current version with `amplify -version` and upgrade to the latest version with `amplify upgrade`. +Push Notifications requires version **12.12.3+** of the Amplify CLI. You can check your current version with `amplify -version` and upgrade to the latest version with `amplify upgrade`. diff --git a/src/fragments/lib/push-notifications/android/getting_started/fcm-cli-resources.mdx b/src/fragments/lib/push-notifications/android/getting_started/fcm-cli-resources.mdx index 8195fee2895..46f1906faa2 100644 --- a/src/fragments/lib/push-notifications/android/getting_started/fcm-cli-resources.mdx +++ b/src/fragments/lib/push-notifications/android/getting_started/fcm-cli-resources.mdx @@ -16,4 +16,4 @@ Choose _FCM_ when promoted: ``` -The CLI will prompt for your _Server Key_, paste the **Token** you copied while [setting up push notification services](/gen1/[platform]/build-a-backend/push-notifications/set-up-push-service/). +The CLI will prompt for your _service account key (json file) path_ created from steps in [setting up push notification services](/gen1/[platform]/build-a-backend/push-notifications/set-up-push-service/). Enter the absolute path, or a path relative to the location where you ran the command. diff --git a/src/fragments/lib/push-notifications/android/setup_push_service/setup-fcm.mdx b/src/fragments/lib/push-notifications/android/setup_push_service/setup-fcm.mdx index edc9bc883dc..269563e7839 100644 --- a/src/fragments/lib/push-notifications/android/setup_push_service/setup-fcm.mdx +++ b/src/fragments/lib/push-notifications/android/setup_push_service/setup-fcm.mdx @@ -6,7 +6,7 @@ Push notifications for Android apps are sent using Firebase Cloud Messaging (FCM - [Register your app with Firebase](https://firebase.google.com/docs/cloud-messaging/android/first-message#register_your_app_with_firebase) - [Add a Firebase configuration file](https://firebase.google.com/docs/cloud-messaging/android/first-message#add_a_firebase_configuration_file) -Next, you will need to access your **ServerKey** (Referred to as **ApiKey** in the CLI setup): +Next, you will need to create your service account key (json file): - Open the [Firebase console](https://console.firebase.google.com/). - Choose your Firebase project. @@ -14,15 +14,9 @@ Next, you will need to access your **ServerKey** (Referred to as **ApiKey** in t ![image](/images/push-notifications/setup-fcm/project-settings.png) -- Select the **Cloud Messaging** tab. -- Select the three vertical dots next to **Cloud Messaging API (Legacy)**, then select **Manage API in Google Cloud Console**. ![The three dot menu button is circled in the cloud messaging tab.](/images/push-notifications/firebaseconsole.png) +- Select the **Service accounts** tab. +- Select **Firebase Admin SDK** in the sidebar +- Click **Generate new private key** +- Keep the downloaded service account key (json file) safe. You will need to provide the path to the CLI. -![image](/images/push-notifications/setup-fcm/manage-api.png) - -- In the new tab, select the **Enable** button. -- Return to the previous page and refresh it. -- Copy the **Server key** token - -![image](/images/push-notifications/setup-fcm/server-id.png) - -Return to [Provisioning resources through CLI](/gen1/[platform]/build-a-backend/push-notifications/set-up-push-notifications/#provisioning-resources-through-cli) with the copied **Token** +Return to [Provisioning resources through CLI](/gen1/[platform]/build-a-backend/push-notifications/set-up-push-notifications/#provisioning-resources-through-cli) for instructions on providing the service account key (json file). diff --git a/src/fragments/lib/push-notifications/common/getting_started/getting-started.mdx b/src/fragments/lib/push-notifications/common/getting_started/getting-started.mdx index 38194bc28f3..d6a70895f3c 100644 --- a/src/fragments/lib/push-notifications/common/getting_started/getting-started.mdx +++ b/src/fragments/lib/push-notifications/common/getting_started/getting-started.mdx @@ -38,7 +38,7 @@ To use Push Notifications with Amplify, you have the option to either have the A -Push Notifications requires version **10.8.0+** of the Amplify CLI. You can check your current version with `amplify -version` and upgrade to the latest version with `amplify upgrade`. +Push Notifications requires version **12.12.3+** of the Amplify CLI. You can check your current version with `amplify -version` and upgrade to the latest version with `amplify upgrade`. diff --git a/src/fragments/sdk/push-notifications/android/getting-started.mdx b/src/fragments/sdk/push-notifications/android/getting-started.mdx index e4026e90c66..54de59e41be 100644 --- a/src/fragments/sdk/push-notifications/android/getting-started.mdx +++ b/src/fragments/sdk/push-notifications/android/getting-started.mdx @@ -6,6 +6,12 @@ Enable your users to receive mobile push messages sent from the Apple (APNs) and 1. Use the CLI to add storage to your cloud-enabled backend and app. + + +Push Notifications requires version **12.12.3+** of the Amplify CLI. You can check your current version with `amplify -version` and upgrade to the latest version with `amplify upgrade`. + + + 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. ```bash @@ -21,7 +27,7 @@ Enable your users to receive mobile push messages sent from the Apple (APNs) and > FCM ``` - - Provide your `Server Key`. For information on getting an FCM `Server Key`, see the section [Setting Up FCM/GCM Guide](/gen1/[platform]/sdk/push-notifications/setup-push-service/). Use the steps in the next section to connect your app to your backend. + - Provide your `service account key (json file) path` (relative or absolute). For information on getting an FCM `service account key`, see the section [Setting Up FCM/GCM Guide](/gen1/[platform]/sdk/push-notifications/setup-push-service/). Use the steps in the next section to connect your app to your backend. ## Connect to Your Backend diff --git a/src/fragments/sdk/push-notifications/android/setup-fcm.mdx b/src/fragments/sdk/push-notifications/android/setup-fcm.mdx index c22dc0868a1..2829608a55d 100644 --- a/src/fragments/sdk/push-notifications/android/setup-fcm.mdx +++ b/src/fragments/sdk/push-notifications/android/setup-fcm.mdx @@ -8,13 +8,15 @@ You can enable your Android app to receive push notifications that you send thro 1. In the Firebase console, choose *Download google-services.json*. Copy the downloaded `google-services.json` file to the `app` directory of your Android project. -To access the `Server Key`: +To access the `service account key (json file)`: 1. Open the [Firebase console](https://console.firebase.google.com/). -1. Choose your project. +1. Select the gear icon located in the top left hand corner of your screen, then select **Project settings**. -1. Choose the settings icon next to *Project Overview* in the top left and then *Project Settings*. +1. Select the **Service accounts** tab. -1. Open the *Cloud Messaging* tab. +1. Select **Firebase Admin SDK** in the sidebar -1. Copy the token next to *Server key*. +1. Click **Generate new private key** + +1. Keep the downloaded service account key (json file) safe. You will need to provide the path to the CLI.