forked from aws-amplify/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(react-native): Add push notification docs
- Loading branch information
Showing
61 changed files
with
875 additions
and
536 deletions.
There are no files selected for viewing
Binary file added
BIN
+56.7 KB
.../images/push-notifications/cross-platform-lifecycle/pn-lifecycle-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+51.7 KB
.../images/push-notifications/cross-platform-lifecycle/pn-lifecycle-foreground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+71.7 KB
.../images/push-notifications/cross-platform-lifecycle/pn-lifecycle-terminated.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+526 KB
...ic/images/push-notifications/cross-platform-service-extension/01_new-target.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+230 KB
...c/images/push-notifications/cross-platform-service-extension/02_target-type.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+112 KB
...c/images/push-notifications/cross-platform-service-extension/03_target-name.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+175 KB
...mages/push-notifications/cross-platform-service-extension/04_extension-info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+92.8 KB
...ages/push-notifications/cross-platform-service-extension/05_extension-class.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
src/fragments/lib/push-notifications/android/getting_started/10_pre_req.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 2 additions & 37 deletions
39
src/fragments/lib/push-notifications/android/getting_started/20_cli_resources.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,5 @@ | ||
> Prerequisite: [Install and configure the Amplify CLI](/cli/start/install) | ||
import fcmCliResources from '/src/fragments/lib/push-notifications/android/getting_started/fcm-cli-resources.mdx'; | ||
|
||
<Callout warning> | ||
|
||
Push Notifications requires version **10.8.0+** of the Amplify CLI. You can check your current version by typing `amplify -version` and upgrade to the latest version by typing `amplify upgrade`. | ||
|
||
</Callout> | ||
|
||
To start provisioning push notifications resources in the backend, go to your project directory and execute the command: | ||
|
||
```sh | ||
amplify add notifications | ||
``` | ||
|
||
Choose *FCM* when promoted: | ||
|
||
```console | ||
? Choose the push notification channel to enable. | ||
APNS | Apple Push Notifications | ||
❯ FCM | » Firebase Push Notifications | ||
In-App Messaging | ||
SMS | ||
|
||
? Provide your pinpoint resource name: | ||
`yourPinpointResourceName` | ||
|
||
? Apps need authorization to send analytics events. Do you want to allow guests and unauthenticated users to send analytics events? (we recommend you allow this when getting started) (Y/n) | ||
'Y' | ||
|
||
``` | ||
|
||
The CLI will prompt for your *ApiKey*, paste the **Token** you copied while [setting up push notification services](/lib/push-notifications/setup-push-service/). | ||
Once all your configuration is complete run the following: | ||
|
||
```sh | ||
amplify push | ||
``` | ||
<Fragments fragments={{ android: fcmCliResources }} /> | ||
|
||
Upon completion, `amplifyconfiguration.json` will be updated to reference the newly provisioned backend push notifications resources. Note that this file should already be generated for you by the Amplify CLI as a part of your project if you followed the [project setup walkthrough](/lib/project-setup/prereq). |
23 changes: 23 additions & 0 deletions
23
src/fragments/lib/push-notifications/android/getting_started/fcm-cli-resources.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Choose _FCM_ when promoted: | ||
|
||
```console | ||
? Choose the push notification channel to enable. | ||
APNS | Apple Push Notifications | ||
❯ FCM | » Firebase Push Notifications | ||
In-App Messaging | ||
SMS | ||
|
||
? Provide your pinpoint resource name: | ||
`yourPinpointResourceName` | ||
|
||
? Apps need authorization to send analytics events. Do you want to allow guests and unauthenticated users to send analytics events? (we recommend you allow this when getting started) (Y/n) | ||
'Y' | ||
|
||
``` | ||
|
||
The CLI will prompt for your _ApiKey_, paste the **Token** you copied while [setting up push notification services](/lib/push-notifications/setup-push-service/). Once all your configuration is complete run the following: | ||
|
||
```sh | ||
amplify push | ||
``` |
1 change: 1 addition & 0 deletions
1
src/fragments/lib/push-notifications/android/getting_started/fcm-pre-req.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Push Notifications are delivered via Firebase Cloud Messaging (FCM), In order to use FCM, you need to register your app on the Firebase console. See [Setting up push notification services](/lib/push-notifications/setup-push-service/) for more information. |
2 changes: 2 additions & 0 deletions
2
src/fragments/lib/push-notifications/android/identify_user/10_get_auth_user.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...ts/lib/push-notifications/android/identify_user/30_send_to_pinpoint_profile.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...ragments/lib/push-notifications/android/setup_push_service/handling-actions.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## Handling FCM Push Notifications | ||
|
||
Amazon Pinpoint campaigns can take one of three actions when a user taps a notification: Open your app, Go to a URL, or Open a deep link. Follow these [instructions](https://developer.android.com/training/app-links/deep-linking) to enable your app to open deep links. |
9 changes: 3 additions & 6 deletions
9
src/fragments/lib/push-notifications/android/setup_push_service/setup-fcm.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
## Setting Up FCM for Push Notifications | ||
|
||
Push notifications for Android apps are sent using Firebase Cloud Messaging (FCM). Before you can send push notifications to Android devices, you must perform the following steps: | ||
|
||
- [Create a Firebase project](https://firebase.google.com/docs/cloud-messaging/android/first-message#create_a_firebase_project). | ||
- [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): | ||
|
||
- 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**. | ||
- Select the **Cloud Messaging** tab. | ||
- Select the three vertical dots next to **Cloud Messaging API (Legacy)**, then select **Manage API in Google Cloud Console**. | ||
![Firebase Console](/images/push-notifications/firebaseconsole.png) | ||
- Select the three vertical dots next to **Cloud Messaging API (Legacy)**, then select **Manage API in Google Cloud Console**. ![Firebase Console](/images/push-notifications/firebaseconsole.png) | ||
- In the new tab, select the **Enable** button. | ||
- Return to the previous tab and refresh the page. | ||
- Copy the **Token** next to **Server key** | ||
|
||
Return to [Provisioning resources through CLI](/lib/push-notifications/getting-started/#provisioning-resources-through-cli) with the copied **Token** | ||
|
||
## Handling FCM Push Notifications | ||
|
||
Amazon Pinpoint campaigns can take one of three actions when a user taps a notification: Open your app, Go to a URL, or Open a deep link. Follow these [instructions](https://developer.android.com/training/app-links/deep-linking) to enable your app to open deep links. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.