Skip to content

Commit

Permalink
chore(push): Update fcm setup instructions (#7763)
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerjroach committed Jun 20, 2024
1 parent 908b829 commit 736e3e7
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,17 @@ 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.
- Select the gear icon located in the top left hand corner of your screen, then select **Project settings**.

![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**
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To use Push Notifications with Amplify, you have the option to either have the A
<Callout warning>

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`.

</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,17 @@ 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.
- Select the gear icon located in the top left hand corner of your screen, then select **Project settings**.

![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).
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ To use Push Notifications with Amplify, you have the option to either have the A
<Callout warning>

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`.

</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<Callout warning>

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`.

</Callout>

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
Expand All @@ -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

Expand Down
12 changes: 7 additions & 5 deletions src/fragments/sdk/push-notifications/android/setup-fcm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 736e3e7

Please sign in to comment.