From cbfbde75c6ad4b4bc8c5cda77ae9a4fb3036d230 Mon Sep 17 00:00:00 2001 From: Jordan Nelson Date: Mon, 13 May 2024 16:56:33 -0400 Subject: [PATCH 1/4] chore: refactor push notification docs --- .../getting_started/fcm-cli-resources.mdx | 19 +++ .../android/getting_started/fcm-pre-req.mdx | 1 + .../android/setup_push_service/setup-fcm.mdx | 28 +++ .../common/app-badge-count.mdx | 8 +- .../common/enable-rich-notifications.mdx | 4 +- .../getting_started/cross-platform-prereq.mdx | 8 +- .../getting_started/getting-started.mdx | 50 ++---- .../common/identify-user.mdx | 23 +-- .../interact-with-notifications.mdx | 6 +- .../notification-lifecycle.mdx | 4 +- .../notification-opened.mdx | 8 +- .../notification-received.mdx | 8 +- .../common/receive-device-token.mdx | 4 +- .../common/record-notifications.mdx | 21 --- .../common/register-device.mdx | 17 -- .../common/remote-media.mdx | 3 - .../common/request-permissions.mdx | 12 +- .../cross-platform-setup.mdx | 6 +- .../setup_push_service/setup-push-service.mdx | 10 +- .../app_badge_count/get-badge-count.mdx | 3 + .../app_badge_count/set-badge-count.mdx | 3 + .../add-notifications-pod.mdx | 19 +++ .../getting_started/20_cli_resources.mdx | 20 +++ .../getting_started/30_existing_resources.mdx | 17 ++ .../40_install_lib.mdx | 0 .../50_init_push_notifications.mdx | 48 ++++++ .../identify_user/10_get_auth_user.mdx | 7 + .../identify_user/20_send_to_pinpoint.mdx | 12 ++ .../get-launch-notification.mdx | 5 + .../on-background-notification.mdx | 33 ++++ .../on-foreground-notification.mdx | 12 ++ .../on-notification-opened.mdx | 11 ++ .../terminology.mdx | 2 + .../on-token-received.mdx | 11 ++ .../get-permission-status.mdx | 7 + .../request-permissions.mdx | 9 + .../sample-permissions-flow.mdx | 21 +++ .../ios/getting_started/apns-pre-req.mdx | 7 + .../getting_started/ios-set-entitlements.mdx | 25 +++ .../ios/setup_push_service/setup-apns.mdx | 160 ++++++++++++++++++ .../app_badge_count/app-badge-count.mdx | 22 --- .../enable-rich-notifications.mdx | 42 ----- .../getting_started/cross-platform-prereq.mdx | 45 ----- .../getting_started/getting-started.mdx | 62 ------- .../identify_user/identify-user.mdx | 15 -- .../interact-with-notifications.mdx | 32 ---- .../react-native/receive-device-token.mdx | 20 --- .../on-token-received.mdx | 9 + .../react-native/request-permissions.mdx | 83 --------- .../get-permission-status.mdx | 9 + .../request-permissions.mdx | 11 ++ .../sample-permissions-flow.mdx | 29 ++++ .../app-badge-count/index.mdx | 8 +- .../enable-rich-notifications/index.mdx | 8 +- .../identify-user/index.mdx | 11 +- .../interact-with-notifications/index.mdx | 7 +- .../receive-device-token/index.mdx | 7 +- .../request-permissions/index.mdx | 8 +- .../set-up-push-notifications/index.mdx | 11 +- .../set-up-push-service/index.mdx | 11 +- .../test-notifications/index.mdx | 11 +- 61 files changed, 606 insertions(+), 527 deletions(-) create mode 100644 src/fragments/lib-v1/push-notifications/android/getting_started/fcm-cli-resources.mdx create mode 100644 src/fragments/lib-v1/push-notifications/android/getting_started/fcm-pre-req.mdx create mode 100644 src/fragments/lib-v1/push-notifications/android/setup_push_service/setup-fcm.mdx delete mode 100644 src/fragments/lib-v1/push-notifications/common/record-notifications.mdx delete mode 100644 src/fragments/lib-v1/push-notifications/common/register-device.mdx delete mode 100644 src/fragments/lib-v1/push-notifications/common/remote-media.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/app_badge_count/get-badge-count.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/app_badge_count/set-badge-count.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/enable_rich_notifications/add-notifications-pod.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/getting_started/20_cli_resources.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/getting_started/30_existing_resources.mdx rename src/fragments/lib-v1/push-notifications/flutter/{getting-started => getting_started}/40_install_lib.mdx (100%) create mode 100644 src/fragments/lib-v1/push-notifications/flutter/getting_started/50_init_push_notifications.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/identify_user/10_get_auth_user.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/identify_user/20_send_to_pinpoint.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/get-launch-notification.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/on-background-notification.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/on-foreground-notification.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/on-notification-opened.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/terminology.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/receive_device_token/on-token-received.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/request_permissions/get-permission-status.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/request_permissions/request-permissions.mdx create mode 100644 src/fragments/lib-v1/push-notifications/flutter/request_permissions/sample-permissions-flow.mdx create mode 100644 src/fragments/lib-v1/push-notifications/ios/getting_started/apns-pre-req.mdx create mode 100644 src/fragments/lib-v1/push-notifications/ios/getting_started/ios-set-entitlements.mdx create mode 100644 src/fragments/lib-v1/push-notifications/ios/setup_push_service/setup-apns.mdx delete mode 100644 src/fragments/lib-v1/push-notifications/react-native/app_badge_count/app-badge-count.mdx delete mode 100644 src/fragments/lib-v1/push-notifications/react-native/enable_rich_notifications/enable-rich-notifications.mdx delete mode 100644 src/fragments/lib-v1/push-notifications/react-native/getting_started/cross-platform-prereq.mdx delete mode 100644 src/fragments/lib-v1/push-notifications/react-native/getting_started/getting-started.mdx delete mode 100644 src/fragments/lib-v1/push-notifications/react-native/identify_user/identify-user.mdx delete mode 100644 src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/interact-with-notifications.mdx delete mode 100644 src/fragments/lib-v1/push-notifications/react-native/receive-device-token.mdx create mode 100644 src/fragments/lib-v1/push-notifications/react-native/receive_device_token/on-token-received.mdx delete mode 100644 src/fragments/lib-v1/push-notifications/react-native/request-permissions.mdx create mode 100644 src/fragments/lib-v1/push-notifications/react-native/request_permissions/get-permission-status.mdx create mode 100644 src/fragments/lib-v1/push-notifications/react-native/request_permissions/request-permissions.mdx create mode 100644 src/fragments/lib-v1/push-notifications/react-native/request_permissions/sample-permissions-flow.mdx 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 new file mode 100644 index 00000000000..8195fee2895 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-cli-resources.mdx @@ -0,0 +1,19 @@ +Choose _FCM_ when promoted: + +```console +? Choose the push notification channel to enable. + APNS |  Apple Push Notifications +❯ FCM | » Firebase Push Notifications + In-App Messaging + Email + 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 _Server Key_, paste the **Token** you copied while [setting up push notification services](/gen1/[platform]/build-a-backend/push-notifications/set-up-push-service/). diff --git a/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-pre-req.mdx b/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-pre-req.mdx new file mode 100644 index 00000000000..3f64063726f --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-pre-req.mdx @@ -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](/gen1/[platform]/build-a-backend/push-notifications/set-up-push-service/) for more information. 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 new file mode 100644 index 00000000000..edc9bc883dc --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/android/setup_push_service/setup-fcm.mdx @@ -0,0 +1,28 @@ +## 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**. + +![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) + +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** diff --git a/src/fragments/lib-v1/push-notifications/common/app-badge-count.mdx b/src/fragments/lib-v1/push-notifications/common/app-badge-count.mdx index c261a3b62e2..0aae320132d 100644 --- a/src/fragments/lib-v1/push-notifications/common/app-badge-count.mdx +++ b/src/fragments/lib-v1/push-notifications/common/app-badge-count.mdx @@ -9,8 +9,8 @@ The app badge count, when set, can be seen on your app's icon on a user's device Use `getBadgeCount` to get the current app badge count. You might need to do this to calculate the value when setting the badge count. -import flutterGetBadgeCount from '/src/fragments/lib/push-notifications/flutter/app_badge_count/get-badge-count.mdx'; -import reactNativeGetBadgeCount from '/src/fragments/lib/push-notifications/react-native/app_badge_count/get-badge-count.mdx'; +import flutterGetBadgeCount from '/src/fragments/lib-v1/push-notifications/flutter/app_badge_count/get-badge-count.mdx'; +import reactNativeGetBadgeCount from '/src/fragments/lib-v1/push-notifications/react-native/app_badge_count/get-badge-count.mdx'; An application targeting at least iOS 13.0, using Xcode 14.1 or later. -import apnsPreReq from '/src/fragments/lib/push-notifications/ios/getting_started/apns-pre-req.mdx'; +import apnsPreReq from '/src/fragments/lib-v1/push-notifications/ios/getting_started/apns-pre-req.mdx'; @@ -18,7 +18,7 @@ Using Amplify Push Notifications with APNs requires the following capabilities: To add these capabilities: -import iosSetEntitlements from '/src/fragments/lib/push-notifications/ios/getting_started/ios-set-entitlements.mdx'; +import iosSetEntitlements from '/src/fragments/lib-v1/push-notifications/ios/getting_started/ios-set-entitlements.mdx'; @@ -27,7 +27,7 @@ import iosSetEntitlements from '/src/fragments/lib/push-notifications/ios/gettin An application targeting at least Android SDK API level 24. -import fcmPreReq from '/src/fragments/lib/push-notifications/android/getting_started/fcm-pre-req.mdx'; +import fcmPreReq from '/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-pre-req.mdx'; 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 c54174e4bd4..da8e0de1ea3 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 @@ -1,32 +1,20 @@ The Push Notifications category allows you to integrate push notifications in your app with Amazon Pinpoint targeting, campaign, and journey management support. You can segment your users, trigger push notifications to your app, and record metrics in Pinpoint when users receive or open notifications. Amazon Pinpoint helps you to create messaging campaigns and journeys targeted to specific user segments or demographics and collect interaction metrics with push notifications. -import reactNativeExpoCallout from '/src/fragments/lib/push-notifications/react-native/getting_started/expo-callout.mdx'; +import reactNativeExpoCallout from '/src/fragments/lib-v1/push-notifications/react-native/getting_started/expo-callout.mdx'; ## Prerequisites -import androidPreReq from '/src/fragments/lib/push-notifications/android/getting_started/10_pre_req.mdx'; -import crossPlatformPreReq from '/src/fragments/lib/push-notifications/common/getting_started/cross-platform-prereq.mdx'; -import iosPreReq from '/src/fragments/lib/push-notifications/ios/getting_started/10_pre_req.mdx'; +import crossPlatformPreReq from '/src/fragments/lib-v1/push-notifications/common/getting_started/cross-platform-prereq.mdx'; -import iosSetEntitlements from '/src/fragments/lib/push-notifications/ios/getting_started/20_set_entitlements.mdx'; - - - -import iosCreateAppDelegate from '/src/fragments/lib/push-notifications/ios/getting_started/30_create_app_delegate.mdx'; - - - ## Set up backend resources To use Push Notifications with Amplify, you have the option to either have the Amplify CLI setup resources for you, or you can use an existing Amazon Pinpoint resource in your AWS account. @@ -48,16 +36,12 @@ To start provisioning push notification resources in the backend, go to your pro amplify add notifications ``` -import androidCliResources from '/src/fragments/lib/push-notifications/android/getting_started/20_cli_resources.mdx'; -import iosCliResources from '/src/fragments/lib/push-notifications/ios/getting_started/40_cli_resources.mdx'; -import flutterCliResources from '/src/fragments/lib/push-notifications/flutter/getting_started/20_cli_resources.mdx'; -import reactNativeCliResources from '/src/fragments/lib/push-notifications/react-native/getting_started/20_cli_resources.mdx'; +import flutterCliResources from '/src/fragments/lib-v1/push-notifications/flutter/getting_started/20_cli_resources.mdx'; +import reactNativeCliResources from '/src/fragments/lib-v1/push-notifications/react-native/getting_started/20_cli_resources.mdx'; @@ -65,16 +49,12 @@ import reactNativeCliResources from '/src/fragments/lib/push-notifications/react -import androidExistingResources from '/src/fragments/lib/push-notifications/android/getting_started/30_existing_resources.mdx'; -import flutterExistingResources from '/src/fragments/lib/push-notifications/flutter/getting_started/30_existing_resources.mdx'; -import iosExistingResources from '/src/fragments/lib/push-notifications/ios/getting_started/50_existing_resources.mdx'; -import reactNativeExistingResources from '/src/fragments/lib/push-notifications/react-native/getting_started/30_existing_resources.mdx'; +import flutterExistingResources from '/src/fragments/lib-v1/push-notifications/flutter/getting_started/30_existing_resources.mdx'; +import reactNativeExistingResources from '/src/fragments/lib-v1/push-notifications/react-native/getting_started/30_existing_resources.mdx'; @@ -84,36 +64,28 @@ import reactNativeExistingResources from '/src/fragments/lib/push-notifications/ ## Install Amplify Libraries -import androidInstallLib from '/src/fragments/lib/push-notifications/android/getting_started/40_install_lib.mdx'; -import flutterInstallLib from '/src/fragments/lib-v1/push-notifications/flutter/getting-started/40_install_lib.mdx'; -import iosInstallLib from '/src/fragments/lib/push-notifications/ios/getting_started/60_install_lib.mdx'; -import reactNativeInstallLib from '/src/fragments/lib/push-notifications/react-native/getting_started/40_install_lib.mdx'; +import flutterInstallLib from '/src/fragments/lib-v1/push-notifications/flutter/getting_started/40_install_lib.mdx'; +import reactNativeInstallLib from '/src/fragments/lib-v1/push-notifications/react-native/getting_started/40_install_lib.mdx'; -import reactNativeIntegrateNativeModule from '/src/fragments/lib/push-notifications/react-native/getting_started/50_integrate_native_modules.mdx'; +import reactNativeIntegrateNativeModule from '/src/fragments/lib-v1/push-notifications/react-native/getting_started/50_integrate_native_modules.mdx'; ## Initialize Amplify Push Notifications -import androidInitPN from '/src/fragments/lib/push-notifications/android/getting_started/50_init_push_notifications.mdx'; -import flutterInitPN from '/src/fragments/lib/push-notifications/flutter/getting_started/50_init_push_notifications.mdx'; -import iosInitPN from '/src/fragments/lib/push-notifications/ios/getting_started/70_init_push_notifications.mdx'; -import reactNativeInitPN from '/src/fragments/lib/push-notifications/react-native/getting_started/60_init_push_notifications.mdx'; +import flutterInitPN from '/src/fragments/lib-v1/push-notifications/flutter/getting_started/50_init_push_notifications.mdx'; +import reactNativeInitPN from '/src/fragments/lib-v1/push-notifications/react-native/getting_started/60_init_push_notifications.mdx'; diff --git a/src/fragments/lib-v1/push-notifications/common/identify-user.mdx b/src/fragments/lib-v1/push-notifications/common/identify-user.mdx index 353c9d98eda..0eafd6a930d 100644 --- a/src/fragments/lib-v1/push-notifications/common/identify-user.mdx +++ b/src/fragments/lib-v1/push-notifications/common/identify-user.mdx @@ -2,16 +2,12 @@ This call identifies the current user (which could be unauthenticated or authent ## Get the user ID from Amplify Auth -import androidGetUser from '/src/fragments/lib/push-notifications/android/identify_user/10_get_auth_user.mdx'; -import flutterGetUser from '/src/fragments/lib/push-notifications/flutter/identify_user/10_get_auth_user.mdx'; -import iosGetUser from '/src/fragments/lib/push-notifications/ios/identify_user/10_get_auth_user.mdx'; -import reactNativeGetUser from '/src/fragments/lib/push-notifications/react-native/identify_user/10_get_auth_user.mdx'; +import flutterGetUser from '/src/fragments/lib-v1/push-notifications/flutter/identify_user/10_get_auth_user.mdx'; +import reactNativeGetUser from '/src/fragments/lib-v1/push-notifications/react-native/identify_user/10_get_auth_user.mdx'; @@ -20,23 +16,12 @@ import reactNativeGetUser from '/src/fragments/lib/push-notifications/react-nati Once you have a string that identifies the current user (either from the Auth category as shown above or through your own application logic), you can identify the user to Amazon Pinpoint with the following: -import androidSendToPinpoint from '/src/fragments/lib/push-notifications/android/identify_user/20_send_to_pinpoint.mdx'; -import flutterSendToPinpoint from '/src/fragments/lib/push-notifications/flutter/identify_user/20_send_to_pinpoint.mdx'; -import iosSendToPinpoint from '/src/fragments/lib/push-notifications/ios/identify_user/20_send_to_pinpoint.mdx'; -import reactNativeSendToPinpoint from '/src/fragments/lib/push-notifications/react-native/identify_user/20_send_to_pinpoint.mdx'; +import flutterSendToPinpoint from '/src/fragments/lib-v1/push-notifications/flutter/identify_user/20_send_to_pinpoint.mdx'; +import reactNativeSendToPinpoint from '/src/fragments/lib-v1/push-notifications/react-native/identify_user/20_send_to_pinpoint.mdx'; - -import androidSendWithProfile from '/src/fragments/lib/push-notifications/android/identify_user/30_send_to_pinpoint_profile.mdx'; -import iosSendWithProfile from '/src/fragments/lib/push-notifications/ios/identify_user/30_send_to_pinpoint_profile.mdx'; - - diff --git a/src/fragments/lib-v1/push-notifications/common/interact_with_notifications/interact-with-notifications.mdx b/src/fragments/lib-v1/push-notifications/common/interact_with_notifications/interact-with-notifications.mdx index 9ac148c28b6..8c10c0a96ce 100644 --- a/src/fragments/lib-v1/push-notifications/common/interact_with_notifications/interact-with-notifications.mdx +++ b/src/fragments/lib-v1/push-notifications/common/interact_with_notifications/interact-with-notifications.mdx @@ -4,7 +4,7 @@ Push notifications are powerful engagement tools for your users as they can be d - **Background state**: Your app is still running but is not currently active and visible. The user is usually on the home screen or in another app. - **Terminated state**: Your app is no longer running, even in the background. The user can initiate this by swiping your app away in the app switcher. -import notificationLifecycle from '/src/fragments/lib/push-notifications/common/interact_with_notifications/notification-lifecycle.mdx'; +import notificationLifecycle from '/src/fragments/lib-v1/push-notifications/common/interact_with_notifications/notification-lifecycle.mdx'; -import notificationReceived from '/src/fragments/lib/push-notifications/common/interact_with_notifications/notification-received.mdx'; +import notificationReceived from '/src/fragments/lib-v1/push-notifications/common/interact_with_notifications/notification-received.mdx'; -import notificationOpened from '/src/fragments/lib/push-notifications/common/interact_with_notifications/notification-opened.mdx'; +import notificationOpened from '/src/fragments/lib-v1/push-notifications/common/interact_with_notifications/notification-opened.mdx'; - -import ios1 from '/src/fragments/lib/push-notifications/ios/record_notifications/10_notification_received.mdx'; - - - -## Record Notification Opened - -import android3 from '/src/fragments/lib/push-notifications/android/record_notifications/30_record_notification_opened.mdx'; - - - -import ios4 from '/src/fragments/lib/push-notifications/ios/record_notifications/20_notification_opened.mdx'; - - diff --git a/src/fragments/lib-v1/push-notifications/common/register-device.mdx b/src/fragments/lib-v1/push-notifications/common/register-device.mdx deleted file mode 100644 index e679d608c73..00000000000 --- a/src/fragments/lib-v1/push-notifications/common/register-device.mdx +++ /dev/null @@ -1,17 +0,0 @@ -import ios1 from '/src/fragments/lib/push-notifications/ios/register_device/10_register_intro.mdx'; - - - -import ios4 from '/src/fragments/lib/push-notifications/ios/register_device/20_register_with_apns.mdx'; - - - -## Register with Amazon Pinpoint - -import android0 from '/src/fragments/lib/push-notifications/android/register_device/10_register_with_pinpoint.mdx'; - - - -import ios7 from '/src/fragments/lib/push-notifications/ios/register_device/30_register_with_pinpoint.mdx'; - - diff --git a/src/fragments/lib-v1/push-notifications/common/remote-media.mdx b/src/fragments/lib-v1/push-notifications/common/remote-media.mdx deleted file mode 100644 index dcdac08a5de..00000000000 --- a/src/fragments/lib-v1/push-notifications/common/remote-media.mdx +++ /dev/null @@ -1,3 +0,0 @@ -import ios0 from '/src/fragments/lib/push-notifications/ios/remote_media/10_remote_media.mdx'; - - diff --git a/src/fragments/lib-v1/push-notifications/common/request-permissions.mdx b/src/fragments/lib-v1/push-notifications/common/request-permissions.mdx index 2890b948232..1c9a56ebf5b 100644 --- a/src/fragments/lib-v1/push-notifications/common/request-permissions.mdx +++ b/src/fragments/lib-v1/push-notifications/common/request-permissions.mdx @@ -11,8 +11,8 @@ The first step to request permissions from your user is to understand the curren - **Granted** - Permissions have been granted by the user. No further actions are needed and their app is ready to display notifications. - **Denied** - Permissions have been denied by the user. Further attempts to request permissions will no longer trigger a permission dialog. Your app should now either degrade gracefully or prompt your user to grant the permissions needed in their device settings. -import flutterGetPermissionStatus from '/src/fragments/lib/push-notifications/flutter/request_permissions/get-permission-status.mdx'; -import reactNativeGetPermissionStatus from '/src/fragments/lib/push-notifications/react-native/request_permissions/get-permission-status.mdx'; +import flutterGetPermissionStatus from '/src/fragments/lib-v1/push-notifications/flutter/request_permissions/get-permission-status.mdx'; +import reactNativeGetPermissionStatus from '/src/fragments/lib-v1/push-notifications/react-native/request_permissions/get-permission-status.mdx'; -import apnsSetup from '/src/fragments/lib/push-notifications/ios/setup_push_service/setup-apns.mdx'; +import apnsSetup from '/src/fragments/lib-v1/push-notifications/ios/setup_push_service/setup-apns.mdx'; -import fcmSetup from '/src/fragments/lib/push-notifications/android/setup_push_service/setup-fcm.mdx'; +import fcmSetup from '/src/fragments/lib-v1/push-notifications/android/setup_push_service/setup-fcm.mdx'; - \ No newline at end of file + diff --git a/src/fragments/lib-v1/push-notifications/common/setup_push_service/setup-push-service.mdx b/src/fragments/lib-v1/push-notifications/common/setup_push_service/setup-push-service.mdx index ba45aaf9eb1..9ebb560a581 100644 --- a/src/fragments/lib-v1/push-notifications/common/setup_push_service/setup-push-service.mdx +++ b/src/fragments/lib-v1/push-notifications/common/setup_push_service/setup-push-service.mdx @@ -1,16 +1,8 @@ -import androidSetupService from '/src/fragments/lib/push-notifications/android/setup_push_service/setup-fcm.mdx'; -import crossPlatformSetupService from '/src/fragments/lib/push-notifications/common/setup_push_service/cross-platform-setup.mdx'; -import iosSetupService from '/src/fragments/lib/push-notifications/ios/setup_push_service/setup-apns.mdx'; +import crossPlatformSetupService from '/src/fragments/lib-v1/push-notifications/common/setup_push_service/cross-platform-setup.mdx'; - -import androidHandlingActions from '/src/fragments/lib/push-notifications/android/setup_push_service/handling-actions.mdx'; - - diff --git a/src/fragments/lib-v1/push-notifications/flutter/app_badge_count/get-badge-count.mdx b/src/fragments/lib-v1/push-notifications/flutter/app_badge_count/get-badge-count.mdx new file mode 100644 index 00000000000..caa63be458d --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/app_badge_count/get-badge-count.mdx @@ -0,0 +1,3 @@ +```dart +final count = await Amplify.Notifications.Push.getBadgeCount(); +``` diff --git a/src/fragments/lib-v1/push-notifications/flutter/app_badge_count/set-badge-count.mdx b/src/fragments/lib-v1/push-notifications/flutter/app_badge_count/set-badge-count.mdx new file mode 100644 index 00000000000..7ff9be6aac9 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/app_badge_count/set-badge-count.mdx @@ -0,0 +1,3 @@ +```dart +Amplify.Notifications.Push.setBadgeCount(42); +``` diff --git a/src/fragments/lib-v1/push-notifications/flutter/enable_rich_notifications/add-notifications-pod.mdx b/src/fragments/lib-v1/push-notifications/flutter/enable_rich_notifications/add-notifications-pod.mdx new file mode 100644 index 00000000000..3c26a9e9cf0 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/enable_rich_notifications/add-notifications-pod.mdx @@ -0,0 +1,19 @@ +```ruby +target 'MyNotificationServiceExtension' do # Replace with your service extension + use_frameworks! + + pod "AmplifyUtilsNotifications" +end +``` + +3. Install the new pods by running `pod install` in the `ios/` of your application project. + + + + Note: You will first need to [install Cocoapods](https://guides.cocoapods.org/using/getting-started.html) to enable the `pod` command. + + +```bash +cd ios +pod install +``` diff --git a/src/fragments/lib-v1/push-notifications/flutter/getting_started/20_cli_resources.mdx b/src/fragments/lib-v1/push-notifications/flutter/getting_started/20_cli_resources.mdx new file mode 100644 index 00000000000..816d648b94d --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/getting_started/20_cli_resources.mdx @@ -0,0 +1,20 @@ + + + +import apnsCliResources from '/src/fragments/lib/push-notifications/ios/getting_started/apns-cli-resources.mdx'; + + + +Upon completion, `amplifyconfiguration.dart` 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](/gen1/[platform]/start/project-setup/prerequisites/). + + + + +import fcmCliResources from '/src/fragments/lib/push-notifications/android/getting_started/fcm-cli-resources.mdx'; + + + +Upon completion, `amplifyconfiguration.dart` 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](/gen1/[platform]/start/project-setup/prerequisites/). + + + diff --git a/src/fragments/lib-v1/push-notifications/flutter/getting_started/30_existing_resources.mdx b/src/fragments/lib-v1/push-notifications/flutter/getting_started/30_existing_resources.mdx new file mode 100644 index 00000000000..fadde219181 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/getting_started/30_existing_resources.mdx @@ -0,0 +1,17 @@ +Existing Amazon Pinpoint resources can be used with Amplify Push Notifications by configuring `amplifyconfiguration.dart` with **Application ID** and **Region**. + +```dart +{ + "notifications": { + "plugins": { + "awsPinpointPushNotificationsPlugin": { + "appId": "", + "region": "" + } + } + } +} +``` + +- **appId**: Amazon Pinpoint application ID +- **region**: AWS Region where the resources are provisioned (e.g. `us-east-1`) diff --git a/src/fragments/lib-v1/push-notifications/flutter/getting-started/40_install_lib.mdx b/src/fragments/lib-v1/push-notifications/flutter/getting_started/40_install_lib.mdx similarity index 100% rename from src/fragments/lib-v1/push-notifications/flutter/getting-started/40_install_lib.mdx rename to src/fragments/lib-v1/push-notifications/flutter/getting_started/40_install_lib.mdx diff --git a/src/fragments/lib-v1/push-notifications/flutter/getting_started/50_init_push_notifications.mdx b/src/fragments/lib-v1/push-notifications/flutter/getting_started/50_init_push_notifications.mdx new file mode 100644 index 00000000000..efc780e3857 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/getting_started/50_init_push_notifications.mdx @@ -0,0 +1,48 @@ +To initialize Amplify Push Notifications, you will need to configure Amplify add the Auth and Push Notifications plugins. To complete initialization, call `Amplify.configure` + +Your resulting code should look something like the following: + +```dart +// Example main.dart + +import 'package:amplify_auth_cognito/amplify_auth_cognito.dart'; +import 'package:amplify_flutter/amplify_flutter.dart'; +import 'package:amplify_push_notifications_pinpoint/amplify_push_notifications_pinpoint.dart'; + +import 'amplifyconfiguration.dart'; + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatefulWidget { + const MyApp({Key? key}) : super(key: key); + + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State { + @override + void initState() { + super.initState(); + _configureAmplify(); + } + + Future _configureAmplify() async { + try { + final authPlugin = AmplifyAuthCognito(); + final pushPlugin = AmplifyPushNotificationsPinpoint(); + await Amplify.addPlugins([authPlugin, pushPlugin]); + await Amplify.configure(amplifyconfig); + } on Exception catch (e) { + safePrint('An error occurred configuring Amplify: $e'); + } + } + + @override + Widget build(BuildContext context) { + // Your application UI + } +} +``` diff --git a/src/fragments/lib-v1/push-notifications/flutter/identify_user/10_get_auth_user.mdx b/src/fragments/lib-v1/push-notifications/flutter/identify_user/10_get_auth_user.mdx new file mode 100644 index 00000000000..fab245ea0bd --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/identify_user/10_get_auth_user.mdx @@ -0,0 +1,7 @@ +If the user is signed in through [Amplify.Auth.signIn](/gen1/[platform]/build-a-backend/auth/enable-sign-in/), then you can retrieve the current user's ID as shown below: + +```dart +final user = await Amplify.Auth.getCurrentUser(); + +final userId = user.userId +``` diff --git a/src/fragments/lib-v1/push-notifications/flutter/identify_user/20_send_to_pinpoint.mdx b/src/fragments/lib-v1/push-notifications/flutter/identify_user/20_send_to_pinpoint.mdx new file mode 100644 index 00000000000..c87bd36d22c --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/identify_user/20_send_to_pinpoint.mdx @@ -0,0 +1,12 @@ +```dart +final userProfile = AWSPinpointUserProfile( + userAttributes: { + 'hobbies': ['cooking', 'knitting'] + }, +); + +await Amplify.Notifications.Push.identifyUser( + userId: userId, + userProfile: userProfile, +); +``` diff --git a/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/get-launch-notification.mdx b/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/get-launch-notification.mdx new file mode 100644 index 00000000000..bfb5c0bbea3 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/get-launch-notification.mdx @@ -0,0 +1,5 @@ +```dart +final launchNotification = Amplify.Notifications.Push.launchNotification; + +... // Take further action with the `launchNotification` +``` diff --git a/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/on-background-notification.mdx b/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/on-background-notification.mdx new file mode 100644 index 00000000000..0092f590427 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/on-background-notification.mdx @@ -0,0 +1,33 @@ +1. You should add this listener to your app's `main` function but _before_ `runApp` and `Amplify.configure` to avoid missing events. +2. The listener function added should be a [top-level global](https://dart.dev/language/functions#lexical-scope) or [static method](https://dart.dev/language/classes#static-methods) so that it can be invoked even when the app is terminated. +3. Notifications received in a terminated state will be considered low priority by Android unless you increase the priority of the payload by setting the `priority` to `high` (you will need to create a _Raw Message_ in Amazon Pinpoint to set this priority). + +```dart +// Example main.dart + +// Note: This handler does not *need* to be async, but it can be! +Future myAsyncNotificationReceivedHandler( + PushNotificationMessage notification) async { + // Process the received push notification message in the background +} + +void main() { + // Needed to enable background API in the killed state. + WidgetsFlutterBinding.ensureInitialized(); + + final authPlugin = AmplifyAuthCognito(); + final notificationsPlugin = AmplifyPushNotificationsPinpoint(); + + // Should be added in the main function to avoid missing events. + notificationsPlugin.onNotificationReceivedInBackground( + myAsyncNotificationReceivedHandler + ); + + await Amplify.addPlugins([authPlugin, notificationsPlugin]); + if (!Amplify.isConfigured) { + await Amplify.configure(amplifyconfig); + } + + runApp(const MyApp()); +} +``` diff --git a/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/on-foreground-notification.mdx b/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/on-foreground-notification.mdx new file mode 100644 index 00000000000..6b5c1e96ca0 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/on-foreground-notification.mdx @@ -0,0 +1,12 @@ +```dart +void myNotificationReceivedHandler(PushNotificationMessage notification) { + // Respond to the received push notification message in realtime +} + +final subscription = Amplify + .Notifications.Push.onNotificationReceivedInForeground + .listen(myNotificationReceivedHandler); + +// Remember to cancel the subscription when it is no longer needed +subscription.cancel(); +``` diff --git a/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/on-notification-opened.mdx b/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/on-notification-opened.mdx new file mode 100644 index 00000000000..727f13ccdf4 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/on-notification-opened.mdx @@ -0,0 +1,11 @@ +```dart +void myNotificationOpenedHandler(PushNotificationMessage notification) { + // Take further action with the opened push notification message +} + +final subscription = Amplify.Notifications.Push.onNotificationOpened + .listen(myNotificationReceivedHandler); + +// Remember to cancel the subscription when it is no longer needed +subscription.cancel(); +``` diff --git a/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/terminology.mdx b/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/terminology.mdx new file mode 100644 index 00000000000..232c986ed1a --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/interact_with_notifications/terminology.mdx @@ -0,0 +1,2 @@ +- **Native layer** - This is the native (e.g. iOS or Android) application layer on top of which Flutter apps are built. +- **Application layer** - This is your Flutter app. diff --git a/src/fragments/lib-v1/push-notifications/flutter/receive_device_token/on-token-received.mdx b/src/fragments/lib-v1/push-notifications/flutter/receive_device_token/on-token-received.mdx new file mode 100644 index 00000000000..414ce087d00 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/receive_device_token/on-token-received.mdx @@ -0,0 +1,11 @@ +```dart +void myTokenReceivedHandler(String token) { + // Do something with the received token +} + +final subscription = Amplify.Notifications.Push.onTokenReceived + .listen(myTokenReceivedHandler); + +// Remember to cancel the subscription when it is no longer needed +subscription.cancel(); +``` diff --git a/src/fragments/lib-v1/push-notifications/flutter/request_permissions/get-permission-status.mdx b/src/fragments/lib-v1/push-notifications/flutter/request_permissions/get-permission-status.mdx new file mode 100644 index 00000000000..5dbd90ef4aa --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/request_permissions/get-permission-status.mdx @@ -0,0 +1,7 @@ +```dart +final status = await Amplify.Notifications.Push.getPermissionStatus(); +// PushNotificationPermissionStatus.shouldRequest | +// PushNotificationPermissionStatus.shouldExplainThenRequest | +// PushNotificationPermissionStatus.granted | +// PushNotificationPermissionStatus.denied +``` diff --git a/src/fragments/lib-v1/push-notifications/flutter/request_permissions/request-permissions.mdx b/src/fragments/lib-v1/push-notifications/flutter/request_permissions/request-permissions.mdx new file mode 100644 index 00000000000..73ff8a187b3 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/request_permissions/request-permissions.mdx @@ -0,0 +1,9 @@ +```dart +final result = await Amplify.Notifications.Push.requestPermissions( + // permissions are true by default + // alert: true + badge: true, + sound: true, +); +// true if granted (or already granted), false otherwise +``` diff --git a/src/fragments/lib-v1/push-notifications/flutter/request_permissions/sample-permissions-flow.mdx b/src/fragments/lib-v1/push-notifications/flutter/request_permissions/sample-permissions-flow.mdx new file mode 100644 index 00000000000..f70a2885a17 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/flutter/request_permissions/sample-permissions-flow.mdx @@ -0,0 +1,21 @@ +```dart +void handlePermissions() async { + final status = await Amplify.Notifications.Push.getPermissionStatus(); + switch (status) { + case PushNotificationPermissionStatus.granted: + // no further action is required, user has already granted permissions + break; + case PushNotificationPermissionStatus.denied: + // further attempts to request permissions will no longer do anything + continueWithoutPushNotifications(); + case PushNotificationPermissionStatus.shouldRequest: + // go ahead and request permissions from the user + await Amplify.Notifications.Push.requestPermissions(); + case PushNotificationPermissionStatus.shouldExplainThenRequest: + // you should display some explanation to your user before requesting permissions + await explainUpcomingPermissionRequest(); + // then request permissions + await Amplify.Notifications.Push.requestPermissions(); + } +} +``` diff --git a/src/fragments/lib-v1/push-notifications/ios/getting_started/apns-pre-req.mdx b/src/fragments/lib-v1/push-notifications/ios/getting_started/apns-pre-req.mdx new file mode 100644 index 00000000000..40444fbf35c --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/ios/getting_started/apns-pre-req.mdx @@ -0,0 +1,7 @@ +Push Notifications are delivered via the Apple Push Notification service (APNs). In order to use APNs, you need to setup credentials (keys or certificates) and export your credentials to a p12 file. See [Setting up push notification services](/gen1/[platform]/build-a-backend/push-notifications/set-up-push-service/) for more information. + + + +Testing with APNs on the iOS simulator requires an Apple Silicon Mac running macOS 13+, Xcode 14+, and iOS simulator 16+. If your development environment does not meet all these requirements, then you must run on a real device to get an APNs token. + + diff --git a/src/fragments/lib-v1/push-notifications/ios/getting_started/ios-set-entitlements.mdx b/src/fragments/lib-v1/push-notifications/ios/getting_started/ios-set-entitlements.mdx new file mode 100644 index 00000000000..b98709a1ffd --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/ios/getting_started/ios-set-entitlements.mdx @@ -0,0 +1,25 @@ +1. Open your Xcode project, go to project settings, select your main application target, select the **Signing and Capabilities** tab, and click **+ Capability** in the upper left corner of the editor pane to bring up the Capabilities dialog. + +![Arrow pointing to the plus capability icon.](/images/push-notifications/xcode-entitlements/01_add-capability.png) + + + +Xcode can be a little finicky with this step. If the Capabilities dialog is empty, try switching to a different tab and then switching back to **Signing and Capabilities** + + + +2. Type **push** in the filter box and double-click **Push Notifications** to add the capability. + +![The word push typed into the search bar capabilities and push notifications is a result.](/images/push-notifications/xcode-entitlements/02_add-push.png) + +3. Repeat step 1 to open the Capabilities dialog and then type **back** in the filter box and double-click **Background Modes** to add the capability. + +![The word back typed into the search bar and background modes is a result.](/images/push-notifications/xcode-entitlements/03_add-background.png) + +4. Select **Change All** when prompted. + +5. Under **Background Modes**, select **Remote Notifications** + +![Remote notifications box is selected in the background modes section.](/images/push-notifications/xcode-entitlements/04_background-remote-notifications.png) + +6. Select **Change All** again when prompted. diff --git a/src/fragments/lib-v1/push-notifications/ios/setup_push_service/setup-apns.mdx b/src/fragments/lib-v1/push-notifications/ios/setup_push_service/setup-apns.mdx new file mode 100644 index 00000000000..e0eab422d15 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/ios/setup_push_service/setup-apns.mdx @@ -0,0 +1,160 @@ +## Setting Up APNs for Push Notifications + +Push notifications for iOS apps are sent using Apple Push Notification service (APNs). Before you can send push notifications to iOS devices, you must create an app ID on the Apple Developer portal, and you must create the required certificates. + +This section describes how to use the Apple Developer portal to obtain iOS and APNs credentials. These credentials enable you to create an iOS project that can receive push notifications. + +After completing the steps in this section, you will have the following items in your Apple Developer account: + +- An app ID. +- An SSL certificate, which authorizes you to send push notifications to your app through APNs. +- A registration for your test device, such as an iPhone, with your Apple Developer account. +- An iOS distribution certificate, which enables you to install your app on your test device. +- A provisioning profile, which allows your app to run on your test device. + +Before you begin, you must have an account with the Apple Developer Program as an individual or as part of an organization, and you must have agent or admin privileges in that account. + +**Topics** + +- [Step 1: Create an App ID](#step-1-create-an-app-id) +- [Step 2: Create an APNs SSL Certificate](#step-2-create-an-apns-ssl-certificate) +- [Step 3: Register a Test Device](#step-3-register-a-test-device) +- [Step 4: Create an iOS Distribution Certificate](#step-4-create-an-ios-distribution-certificate) +- [Step 5: Create a Provisioning Profile](#step-5-create-a-provisioning-profile) + +### Step 1: Create an App ID + +Create an app ID to identify your app in the Apple Developer portal. You need this ID when you create an SSL certificate for sending push notifications, when you create an iOS distribution certificate, and when you create a provisioning profile. + +If you already have an ID assigned to your app, you can skip this step. You can use an existing app ID provided it doesn't contain a wildcard character ("\*"). + +**To assign an App ID to your app** + +- Sign in to your [Apple Developer account](https://developer.apple.com/membercenter/index.action) and navigate to [Identifiers](https://developer.apple.com/account/resources/identifiers/list) +- In the **Identifiers** pane, click the **Register an App ID** button, or click the blue **(+)** button in the header. + +![image](/images/push-notifications/setup-apns/create-identifier--add.png) + +- In the **Register a new identifier** pane, Select **App IDs** and click **Continue**. + +![image](/images/push-notifications/setup-apns/create-identifier--app-id.png) + +- In the **Register a new identifier** pane, Select **App** and click **Continue**. + +![image](/images/push-notifications/setup-apns/create-identifier--app-type.png) + +- In the **Registering an App ID** pane, for **Description**, type a name for your app ID that makes it easy to recognize later. +- For **App ID Prefix**, select **Explicit**, and type a bundle ID for your app. If you already have an app, use the bundle ID assigned to it. You can find this ID in the app project in Xcode on your Mac. Otherwise, take note of the bundle ID because you will assign it to your app in Xcode later. + +![image](/images/push-notifications/setup-apns/create-identifier--bundle-id.png) + +- Under **Capabilities**, select **Push Notifications**. + +![image](/images/push-notifications/setup-apns/create-identifier--enable-PN.png) + +- Click **Continue**. In the **Confirm your App ID** pane, check that all values were entered correctly. +- Click **Register** to register the new app ID. + +### Step 2: Create an APNs SSL Certificate + +You will create and download a certificate from your Apple Developer account. Then, you will install the certificate in Keychain Access and export it as a `.p12` file. Which will allow Pinpoint to communicate with Apple's Push Notification Service (APNS). + +If you already have an SSL certificate for your app, you can skip this step. + +**To create an SSL certificate for push notifications** + +- Under **Certificates, Identifiers & Profiles**, navigate to [Identifiers](https://developer.apple.com/account/resources/identifiers/list) +- From the list of iOS Identifiers, click the app that you created in [Step 1: Create an App ID](#step-1-create-an-app-id). +- Under **Capabilities**, locate **Push Notifications**, click **Configure** + +![image](/images/push-notifications/setup-apns/create-certificate--configure.png) + +- In the **Production SSL Certificate** section, click **Create Certificate**. + +![image](/images/push-notifications/setup-apns/create-certificate--create.png) + +- Follow these [instructions](https://developer.apple.com/help/account/create-certificates/create-a-certificate-signing-request) for creating a local Certificate Signing Request (CSR) file using the Keychain Access application on your Mac. + +![image](/images/push-notifications/setup-apns/create-certificate--cert-assistant.png) + +- In the **Create a New Certificate** pane, click **Choose File**, and then select the CSR file you created and click **Continue**. + +![image](/images/push-notifications/setup-apns/create-certificate--upload-cert.png) + +- When the certificate is ready, click **Download** to save the certificate to your computer. It should be called `aps.cer`. +- Double-click the downloaded certificate to install it to the Keychain on your Mac. +- On your Mac, start the Keychain Access application. +- Click the **My Certificates** chip in the toolbar to find the certificate you just added. The certificate will be named "Apple Push Services:`com.my.app.id`", where `com.my.app.id` is the bundle ID you configured in the previous step. + +![image](/images/push-notifications/setup-apns/create-certificate--my-cert.png) + +- Right-click the push certificate and then select **Export "Apple Push Services:`com.my.app.id`"** from the context menu to export a file containing the certificate. + +![image](/images/push-notifications/setup-apns/create-certificate--export-cert.png) + +- Name the file `amplify` and ensure that `p12` is selected as the export format, then save it to your computer. Click **OK** to skip adding a password to the certificate. Then enter your computer password to complete the export. + + + +Note: The remaining steps are done automatically in Xcode when the "Automatically manage signing" box is checked. + + + +### Step 3: Register a Test Device + +Register a test device with your Apple Developer account so that you can test your app on that device. Later, you associate this test device with your provisioning profile, which allows your app to launch on your device. + +If you already have a registered device, you can skip this step. + +**To add a device** + +- Under **Certificates, Identifiers & Profiles**, navigate to [Devices](https://developer.apple.com/account/resources/devices/list) +- In the **Devices** pane, click the **Register a Device** button, or click the blue **(+)** button in the header. +- In the **Register Device** section, choose the platform of device that you want to add, such as **iOS**. +- For **Device Name**, type a name that is easy to recognize later. +- For **Device ID (UDID)**, type the unique device ID. For an iPhone, you can find the UDID by completing the following steps: + + - Connect your iPhone to your Mac with a USB cable. + - Open the Xcode app. + - In the Xcode menu bar navigate to **Window > Devices and Simulators** + - Xcode will display the summary page for your connected devices, select desired device. + - In the header, the summary page provides information about your iPhone. The value next to **Identifier: ** is your **UDID**. + - Select and copy your **UDID**. + - Paste your UDID into the **UDID** field in the Apple Developer website. + - Click **Continue**. + +- On the **Register a New Device** pane, verify the details for your device, and click **Register**. +- Your device name and identifier have been added to the list of devices. Click **Done**. + +### Step 4: Create an iOS Distribution Certificate + +An iOS distribution certificate enables you to install your app on a test device and deliver push notifications to that device. You specify your iOS distribution certificate later when you create a provisioning profile for your app. + +If you already have an iOS distribution certificate, you can skip this step. + +**To create an iOS distribution certificate** + +- Under **Certificates, Identifiers & Profiles**, navigate to [Certificates](https://developer.apple.com/account/resources/certificates/list) +- In the **Certificates** pane, click the blue **(+)** button in the header. The **Create a New Certificate** pane is shown. +- In the **Software** section, select **iOS Distribution (App Store and Ad Hoc)**, and then click **Continue**. +- Follow these [instructions](https://developer.apple.com/help/account/create-certificates/create-a-certificate-signing-request) for creating a Certificate Signing Request (CSR) file. You use the Keychain Access application on your Mac to create the request and save it on your local disk. +- In the **Create a New Certificate** pane, click **Choose File**, and then select the CSR file you created and click **Continue**. +- When the certificate is ready, click **Download** to save the certificate to your computer. +- Double-click the downloaded certificate to install it in Keychain on your Mac. + +### Step 5: Create a Provisioning Profile + +A provisioning profile allows your app to run on your test device. You create and download a provisioning profile from your Apple Developer account and then install the provisioning profile in Xcode. + +**To create a provisioning profile** + +- Under **Certificates, Identifiers & Profiles**, navigate to [Profiles](https://developer.apple.com/account/resources/profiles/list) +- In the **Profiles** pane, click the **Generate a profile** button, or click the blue **(+)** button in the header. The **Register a New Provisioning Profile** pane is shown. +- Under the **Distribution** section, select **Ad Hoc**, and then click **Continue**. +- For **Select an App ID**, select the app ID you created for your app, and then click **Continue**. +- Select your iOS Distribution certificate and then click **Continue**. +- For **Select devices**, select the device that you registered for testing, and click **Continue**. +- Type a name for this provisioning profile, such as `ApnsDistributionProfile`, and click **Generate**. +- Click **Download** to download the generated provisioning profile. +- Install the provisioning profile by double-clicking the downloaded file. The Xcode app opens in response. +- To verify that the provisioning profile is installed, check the list of installed provisioning profiles in Xcode by following this [guide](https://help.apple.com/xcode/mac/current/#/devaafd622d2). diff --git a/src/fragments/lib-v1/push-notifications/react-native/app_badge_count/app-badge-count.mdx b/src/fragments/lib-v1/push-notifications/react-native/app_badge_count/app-badge-count.mdx deleted file mode 100644 index 486f663c7bf..00000000000 --- a/src/fragments/lib-v1/push-notifications/react-native/app_badge_count/app-badge-count.mdx +++ /dev/null @@ -1,22 +0,0 @@ -The app badge count, when set, can be seen on your app's icon on a user's device. Amplify provides you with simple helpers to manipulate this number. - - - App badge count helpers are safe to call (but will be ignored) even when your - app is running on platforms where badges are not supported. - - -## Get the current badge count - -Use `getBadgeCount` to get the current app badge count. You might need to do this to calculate the value when setting the badge count. - -import getBadgeCount from '/src/fragments/lib-v1/push-notifications/react-native/app_badge_count/get-badge-count.mdx'; - - - -## Update the badge count - -Use `setBadgeCount` to set the current app badge count. Setting the badge count to `0` (zero) will remove the badge from your app's icon. - -import setBadgeCount from '/src/fragments/lib-v1/push-notifications/react-native/app_badge_count/set-badge-count.mdx'; - - diff --git a/src/fragments/lib-v1/push-notifications/react-native/enable_rich_notifications/enable-rich-notifications.mdx b/src/fragments/lib-v1/push-notifications/react-native/enable_rich_notifications/enable-rich-notifications.mdx deleted file mode 100644 index 7d9466f5550..00000000000 --- a/src/fragments/lib-v1/push-notifications/react-native/enable_rich_notifications/enable-rich-notifications.mdx +++ /dev/null @@ -1,42 +0,0 @@ - - On Android, Amplify Push Notifications should already be configured to handle - rich content for you. - - -Amplify currently supports adding images to your notifications, but there are some additional steps required. - -## Create a Notification Service Extension - -1. Open `.xcworkspace` located inside the `/ios` folder of your application project with Xcode. - -2. In the Xcode project, select **File > New > Target...** - -![The file menu is selected in the toolbar, then the new option is selected, then the target option.](/images/push-notifications/cross-platform-service-extension/01_new-target.png) - -3. Select **Notification Service Extension > Next**. - -![The notification service extension option is selected in the new target popup.](/images/push-notifications/cross-platform-service-extension/02_target-type.png) - -4. Enter a name for your service extension (e.g. MyNotificationServiceExtension) and select **Finish**. - -![Form for the new target options.](/images/push-notifications/cross-platform-service-extension/03_target-name.png) - -## Provide the extension with the Amplify service class - -1. Open `Podfile` located inside the `/ios` folder of your application project with a text editor. - -2. Add `AmplifyUtilsNotifications` to the extension you created above. - -import addNotificationsPod from '/src/fragments/lib-v1/push-notifications/react-native/enable_rich_notifications/add-notifications-pod.mdx'; - - - -4. Open `.xcworkspace` located inside the `/ios` folder of your application project with Xcode. - -5. Find your extension folder in the Project navigator pane and select the **Info** Property List. - -![Extension info](/images/push-notifications/cross-platform-service-extension/04_extension-info.png) - -6. Update the `NSExtensionPrincipalClass` property with the value `AmplifyUtilsNotifications.AUNotificationService`. - -![Extension class](/images/push-notifications/cross-platform-service-extension/05_extension-class.png) diff --git a/src/fragments/lib-v1/push-notifications/react-native/getting_started/cross-platform-prereq.mdx b/src/fragments/lib-v1/push-notifications/react-native/getting_started/cross-platform-prereq.mdx deleted file mode 100644 index 861dd81592e..00000000000 --- a/src/fragments/lib-v1/push-notifications/react-native/getting_started/cross-platform-prereq.mdx +++ /dev/null @@ -1,45 +0,0 @@ -You should have [completed the CLI and project setup steps.](/gen1/[platform]/prev/start/project-setup/prerequisites/) - - - - -An application targeting at least iOS 13.0, using Xcode 14.1 or later. - -import apnsPreReq from '/src/fragments/lib/push-notifications/ios/getting_started/apns-pre-req.mdx'; - - - -### Set Entitlements - -Using Amplify Push Notifications with APNs requires the following capabilities: - -- Push Notifications -- Background Processing -> Remote Notifications - -To add these capabilities: - -import iosSetEntitlements from '/src/fragments/lib/push-notifications/ios/getting_started/ios-set-entitlements.mdx'; - - - - - - -An application targeting at least Android SDK API level 24. - -import fcmPreReq from '/src/fragments/lib/push-notifications/android/getting_started/fcm-pre-req.mdx'; - - - -### Applying the Google services plugin - -The Firebase documentation directs you to add the Google services plugin to your app `build.gradle` using the [Gradle plugins DSL](https://docs.gradle.org/current/userguide/plugins.html#sec:plugins_block). However, we recommend you continue to use the [Legacy Plugin Application](https://docs.gradle.org/current/userguide/plugins.html#sec:old_plugin_application) instead: - -```groovy -apply plugin: 'com.google.gms.google-services' -``` - -If you prefer using the plugins DSL, you should add the `plugins` block to the very top of the file or you may experience issues when building your app for Android. - - - diff --git a/src/fragments/lib-v1/push-notifications/react-native/getting_started/getting-started.mdx b/src/fragments/lib-v1/push-notifications/react-native/getting_started/getting-started.mdx deleted file mode 100644 index a20ed1b4860..00000000000 --- a/src/fragments/lib-v1/push-notifications/react-native/getting_started/getting-started.mdx +++ /dev/null @@ -1,62 +0,0 @@ -The Push Notifications category allows you to integrate push notifications in your app with Amazon Pinpoint targeting, campaign, and journey management support. You can segment your users, trigger push notifications to your app, and record metrics in Pinpoint when users receive or open notifications. Amazon Pinpoint helps you to create messaging campaigns and journeys targeted to specific user segments or demographics and collect interaction metrics with push notifications. - -import expoCallout from '/src/fragments/lib-v1/push-notifications/react-native/getting_started/expo-callout.mdx'; - - - -## Prerequisites - -import crossPlatformPreReq from '/src/fragments/lib-v1/push-notifications/react-native/getting_started/cross-platform-prereq.mdx'; - - - -## Set up backend resources - -To use Push Notifications with Amplify, you have the option to either have the Amplify CLI setup resources for you, or you can use an existing Amazon Pinpoint resource in your AWS account. - - - - -> Prerequisite: [Install and configure the Amplify CLI](/gen1/[platform]/tools/cli/start/set-up-cli/) - - - -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`. - - - -To start provisioning push notification resources in the backend, go to your project directory and execute the command: - -```sh -amplify add notifications -``` - -import cliResources from '/src/fragments/lib-v1/push-notifications/react-native/getting_started/20_cli_resources.mdx'; - - - - - - -import existingResources from '/src/fragments/lib-v1/push-notifications/react-native/getting_started/30_existing_resources.mdx'; - - - - - - -## Install Amplify Libraries - -import installLib from '/src/fragments/lib-v1/push-notifications/react-native/getting_started/40_install_lib.mdx'; - - - -import integrateNativeModule from '/src/fragments/lib-v1/push-notifications/react-native/getting_started/50_integrate_native_modules.mdx'; - - - -## Initialize Amplify Push Notifications - -import initPN from '/src/fragments/lib-v1/push-notifications/react-native/getting_started/60_init_push_notifications.mdx'; - - diff --git a/src/fragments/lib-v1/push-notifications/react-native/identify_user/identify-user.mdx b/src/fragments/lib-v1/push-notifications/react-native/identify_user/identify-user.mdx deleted file mode 100644 index af229e891a6..00000000000 --- a/src/fragments/lib-v1/push-notifications/react-native/identify_user/identify-user.mdx +++ /dev/null @@ -1,15 +0,0 @@ -This call identifies the current user (which could be unauthenticated or authenticated) to Amazon Pinpoint. The user ID can be any string which identifies the user in the context of your application. - -## Get the user ID from Amplify Auth - -import getUser from '/src/fragments/lib-v1/push-notifications/react-native/identify_user/10_get_auth_user.mdx'; - - - -## Identify the user to Amazon Pinpoint - -Once you have a string that identifies the current user (either from the Auth category as shown above or through your own application logic), you can identify the user to Amazon Pinpoint with the following: - -import sendToPinpoint from '/src/fragments/lib-v1/push-notifications/react-native/identify_user/20_send_to_pinpoint.mdx'; - - diff --git a/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/interact-with-notifications.mdx b/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/interact-with-notifications.mdx deleted file mode 100644 index 90e56e17cf2..00000000000 --- a/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/interact-with-notifications.mdx +++ /dev/null @@ -1,32 +0,0 @@ -Push notifications are powerful engagement tools for your users as they can be delivered even when your app is not in the active foreground. As a result, there are many cases where it is helpful (or perhaps necessary) to interact with notification events differently depending upon your app's state. - -- **Foreground state**: Your app is running, active and visible. -- **Background state**: Your app is still running but is not currently active and visible. The user is usually on the home screen or in another app. -- **Terminated state**: Your app is no longer running, even in the background. The user can initiate this by swiping your app away in the app switcher. - -import notificationLifecycle from '/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-lifecycle.mdx'; - - - -import notificationReceived from '/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-received.mdx'; - - - -import notificationOpened from '/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-opened.mdx'; - - diff --git a/src/fragments/lib-v1/push-notifications/react-native/receive-device-token.mdx b/src/fragments/lib-v1/push-notifications/react-native/receive-device-token.mdx deleted file mode 100644 index 4306662f232..00000000000 --- a/src/fragments/lib-v1/push-notifications/react-native/receive-device-token.mdx +++ /dev/null @@ -1,20 +0,0 @@ -Push notifications are delivered to your user's devices through a device token which uniquely identifies your app. Although Amplify will automatically register this token with Amazon Pinpoint, it can still be useful to have access to this token for your app's use cases (e.g. to send direct notifications to a specific device). - -### onTokenReceived - -Add `onTokenReceived` listeners to respond to a token being received by your app. - -A token will be received by your app: - -- On every app launch, including the first install -- When a token changes (this may happen if the service invalidates the token for any reason) - -```js -const myTokenReceivedHandler = (token) => { - // Do something with the received token -}; - -const listener = Notifications.Push.onTokenReceived(myTokenReceivedHandler); - -listener.remove(); // Remember to remove the listener when it is no longer needed -``` diff --git a/src/fragments/lib-v1/push-notifications/react-native/receive_device_token/on-token-received.mdx b/src/fragments/lib-v1/push-notifications/react-native/receive_device_token/on-token-received.mdx new file mode 100644 index 00000000000..35f763cb4fc --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/react-native/receive_device_token/on-token-received.mdx @@ -0,0 +1,9 @@ +```js +const myTokenReceivedHandler = (token) => { + // Do something with the received token +}; + +const listener = Notifications.Push.onTokenReceived(myTokenReceivedHandler); + +listener.remove(); // Remember to remove the listener when it is no longer needed +``` diff --git a/src/fragments/lib-v1/push-notifications/react-native/request-permissions.mdx b/src/fragments/lib-v1/push-notifications/react-native/request-permissions.mdx deleted file mode 100644 index b6eed9f6641..00000000000 --- a/src/fragments/lib-v1/push-notifications/react-native/request-permissions.mdx +++ /dev/null @@ -1,83 +0,0 @@ -Depending on your users' platform and operating system version, it is likely that you will need to request their permission to display push notifications. - -To learn more about the platform-specific guidances for requesting permissions, you can visit the respective documentations for [iOS](https://developer.apple.com/documentation/usernotifications/asking_permission_to_use_notifications) and [Android](https://developer.android.com/develop/ui/views/notifications/notification-permission). To best aid you in giving your users a good permission experience with platform idiomatic flows, Amplify provides the functionality below. - -## Get permission status - -The first step to request permissions from your user is to understand the current status of permissions. Your app may behave differently in response to these possible statuses below. - -- **Should Request** - No permissions have been requested yet. It is idiomatic at this time to simply request for permissions from the user. -- **Should Explain Then Request** - It is recommended at this time to provide some context or rationale to the user explaining why you want to send them push notifications before requesting for permissions. -- **Granted** - Permissions have been granted by the user. No further actions are needed and their app is ready to display notifications. -- **Denied** - Permissions have been denied by the user. Further attempts to request permissions will no longer trigger a permission dialog. Your app should now either degrade gracefully or prompt your user to grant the permissions needed in their device settings. - - - If you use TypeScript for your development, the string values returned can be - represented as PushNotificationPermissionStatus enum members as well. - - -```js -const status = await Notifications.Push.getPermissionStatus(); -// 'SHOULD_REQUEST' | 'SHOULD_EXPLAIN_THEN_REQUEST' | 'GRANTED' | 'DENIED' -``` - -## Request permissions - -Once you have determined if the current permission status requires you to request permissions from the user, you can call `requestPermissions()` to make that request. - -Amplify requests all supported notification permissions by default. But you can also choose not to request specific permissions. - - - It is recommended that you specify these permissions if needed but it is - important to note that they are ignored by Android - - -- **Alert**: When set to true, requests the ability to display notifications to the user. -- **Sound**: When set to true, requests the ability to play a sound in response to notifications. -- **Badge**: When set to true, requests the ability to update the app's badge. - -```js -const permissions = { - // permissions are true by default - // alert: true - sound: false, - badge: false -}; - -const result = await Notifications.Push.requestPermissions(permissions); -// true if granted (or already granted), false otherwise -``` - -## Sample permissions flow - -Use `getPermissionStatus()` and `requestPermissions()` together to handle permission request flows. Below is a sample implementation of the expected logic. - - - Remember, if you use TypeScript for your development, you can use the - PushNotificationPermissionStatus enum for comparison as well! - - -```js -async function handlePermissions() { - const status = await Notifications.Push.getPermissionStatus(); - if (status === 'GRANTED') { - // no further action is required, user has already granted permissions - return; - } - if (status === 'DENIED') { - // further attempts to request permissions will no longer do anything - myFunctionToGracefullyDegradeMyApp(); - return; - } - if (status === 'SHOULD_REQUEST') { - // go ahead and request permissions from the user - await Notifications.Push.requestPermissions(); - } - if (status === 'SHOULD_EXPLAIN_THEN_REQUEST') { - // you should display some explanation to your user before requesting permissions - await myFunctionExplainingPermissionsRequest(); - // then request permissions - await Notifications.Push.requestPermissions(); - } -} -``` diff --git a/src/fragments/lib-v1/push-notifications/react-native/request_permissions/get-permission-status.mdx b/src/fragments/lib-v1/push-notifications/react-native/request_permissions/get-permission-status.mdx new file mode 100644 index 00000000000..f5a63cf7320 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/react-native/request_permissions/get-permission-status.mdx @@ -0,0 +1,9 @@ + + If you use TypeScript for your development, the string values returned can be + represented as PushNotificationPermissionStatus enum members as well. + + +```js +const status = await Notifications.Push.getPermissionStatus(); +// 'SHOULD_REQUEST' | 'SHOULD_EXPLAIN_THEN_REQUEST' | 'GRANTED' | 'DENIED' +``` diff --git a/src/fragments/lib-v1/push-notifications/react-native/request_permissions/request-permissions.mdx b/src/fragments/lib-v1/push-notifications/react-native/request_permissions/request-permissions.mdx new file mode 100644 index 00000000000..216c3a505c1 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/react-native/request_permissions/request-permissions.mdx @@ -0,0 +1,11 @@ +```js +const permissions = { + // permissions are true by default + // alert: true + sound: false, + badge: false +}; + +const result = await Notifications.Push.requestPermissions(permissions); +// true if granted (or already granted), false otherwise +``` diff --git a/src/fragments/lib-v1/push-notifications/react-native/request_permissions/sample-permissions-flow.mdx b/src/fragments/lib-v1/push-notifications/react-native/request_permissions/sample-permissions-flow.mdx new file mode 100644 index 00000000000..241c0e40118 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/react-native/request_permissions/sample-permissions-flow.mdx @@ -0,0 +1,29 @@ + + Remember, if you use TypeScript for your development, you can use the + PushNotificationPermissionStatus enum for comparison as well! + + +```js +async function handlePermissions() { + const status = await Notifications.Push.getPermissionStatus(); + if (status === 'GRANTED') { + // no further action is required, user has already granted permissions + return; + } + if (status === 'DENIED') { + // further attempts to request permissions will no longer do anything + myFunctionToGracefullyDegradeMyApp(); + return; + } + if (status === 'SHOULD_REQUEST') { + // go ahead and request permissions from the user + await Notifications.Push.requestPermissions(); + } + if (status === 'SHOULD_EXPLAIN_THEN_REQUEST') { + // you should display some explanation to your user before requesting permissions + await myFunctionExplainingPermissionsRequest(); + // then request permissions + await Notifications.Push.requestPermissions(); + } +} +``` diff --git a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/app-badge-count/index.mdx b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/app-badge-count/index.mdx index 8030af50937..d9392cae89f 100644 --- a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/app-badge-count/index.mdx +++ b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/app-badge-count/index.mdx @@ -26,10 +26,6 @@ import flutter_maintenance from '/src/fragments/lib-v1/flutter-maintenance.mdx'; -import appBadgeCount from '/src/fragments/lib-v1/push-notifications/react-native/app_badge_count/app-badge-count.mdx'; +import appBadgeCount from '/src/fragments/lib-v1/push-notifications/common/app-badge-count.mdx'; - - -import commonRoute from '/src/fragments/lib-v1/push-notifications/common/app-badge-count.mdx'; - - + diff --git a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/enable-rich-notifications/index.mdx b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/enable-rich-notifications/index.mdx index 362441b4753..4504792ef18 100644 --- a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/enable-rich-notifications/index.mdx +++ b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/enable-rich-notifications/index.mdx @@ -26,10 +26,6 @@ import flutter_maintenance from '/src/fragments/lib-v1/flutter-maintenance.mdx'; -import enableRichNotifications from '/src/fragments/lib-v1/push-notifications/react-native/enable_rich_notifications/enable-rich-notifications.mdx'; +import enableRichNotifications from '/src/fragments/lib-v1/push-notifications/common/enable-rich-notifications.mdx'; - - -import commonRoute from '/src/fragments/lib-v1/push-notifications/common/enable-rich-notifications.mdx'; - - + diff --git a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/identify-user/index.mdx b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/identify-user/index.mdx index b6bcfae599a..a9214feb6ac 100644 --- a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/identify-user/index.mdx +++ b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/identify-user/index.mdx @@ -26,14 +26,7 @@ import flutter_maintenance from '/src/fragments/lib-v1/flutter-maintenance.mdx'; -import identifyUser from '/src/fragments/lib-v1/push-notifications/react-native/identify_user/identify-user.mdx'; +import identifyUser from '/src/fragments/lib-v1/push-notifications/common/identify-user.mdx'; - + -import commonRoute from '/src/fragments/lib-v1/push-notifications/common/identify-user.mdx'; - - diff --git a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/interact-with-notifications/index.mdx b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/interact-with-notifications/index.mdx index 67a3ef21677..a7141b86513 100644 --- a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/interact-with-notifications/index.mdx +++ b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/interact-with-notifications/index.mdx @@ -26,10 +26,7 @@ import flutter_maintenance from '/src/fragments/lib-v1/flutter-maintenance.mdx'; -import interactWithNotifications from '/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/interact-with-notifications.mdx'; +import interactWithNotifications from '/src/fragments/lib-v1/push-notifications/common/interact_with_notifications/interact-with-notifications.mdx'; - + -import commonRoute from '/src/fragments/lib-v1/push-notifications/common/interact_with_notifications/interact-with-notifications.mdx'; - - diff --git a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/receive-device-token/index.mdx b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/receive-device-token/index.mdx index e936c035119..3febdb8e73c 100644 --- a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/receive-device-token/index.mdx +++ b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/receive-device-token/index.mdx @@ -26,10 +26,7 @@ import flutter_maintenance from '/src/fragments/lib-v1/flutter-maintenance.mdx'; -import receiveDeviceToken from '/src/fragments/lib-v1/push-notifications/react-native/receive-device-token.mdx'; +import receiveDeviceToken from '/src/fragments/lib-v1/push-notifications/common/receive-device-token.mdx'; - + -import commonRoute from '/src/fragments/lib-v1/push-notifications/common/receive-device-token.mdx'; - - diff --git a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/request-permissions/index.mdx b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/request-permissions/index.mdx index 5c75784f9ef..96f828012c3 100644 --- a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/request-permissions/index.mdx +++ b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/request-permissions/index.mdx @@ -26,10 +26,6 @@ import flutter_maintenance from '/src/fragments/lib-v1/flutter-maintenance.mdx'; -import requestPermissions from '/src/fragments/lib-v1/push-notifications/react-native/request-permissions.mdx'; +import requestPermissions from '/src/fragments/lib-v1/push-notifications/common/request-permissions.mdx'; - - -import commonRoute from '/src/fragments/lib-v1/push-notifications/common/request-permissions.mdx'; - - + diff --git a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/set-up-push-notifications/index.mdx b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/set-up-push-notifications/index.mdx index e3ea256651c..38405e3352a 100644 --- a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/set-up-push-notifications/index.mdx +++ b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/set-up-push-notifications/index.mdx @@ -26,14 +26,7 @@ import flutter_maintenance from '/src/fragments/lib-v1/flutter-maintenance.mdx'; -import gettingStarted from '/src/fragments/lib-v1/push-notifications/react-native/getting_started/getting-started.mdx'; +import gettingStarted from '/src/fragments/lib-v1/push-notifications/common/getting_started/getting-started.mdx'; - + -import commonRoute from '/src/fragments/lib-v1/push-notifications/common/getting_started/getting-started.mdx'; - - diff --git a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/set-up-push-service/index.mdx b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/set-up-push-service/index.mdx index 687b586db07..47ea4590383 100644 --- a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/set-up-push-service/index.mdx +++ b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/set-up-push-service/index.mdx @@ -27,14 +27,7 @@ import flutter_maintenance from '/src/fragments/lib-v1/flutter-maintenance.mdx'; -import crossPlatformSetupService from '/src/fragments/lib/push-notifications/common/setup_push_service/cross-platform-setup.mdx'; +import crossPlatformSetupService from '/src/fragments/lib-v1/push-notifications/common/setup_push_service/setup-push-service.mdx'; - + -import commonRoute from '/src/fragments/lib-v1/push-notifications/common/setup_push_service/setup-push-service.mdx'; - - diff --git a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/test-notifications/index.mdx b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/test-notifications/index.mdx index 07fdf7aff34..94612631f17 100644 --- a/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/test-notifications/index.mdx +++ b/src/pages/gen1/[platform]/prev/build-a-backend/push-notifications/test-notifications/index.mdx @@ -26,14 +26,7 @@ import flutter_maintenance from '/src/fragments/lib-v1/flutter-maintenance.mdx'; -import testing from '/src/fragments/lib/push-notifications/common/testing.mdx'; +import testing from '/src/fragments/lib-v1/push-notifications/common/testing.mdx'; - + -import commonRoute from '/src/fragments/lib-v1/push-notifications/common/testing.mdx'; - - From a2a40bd936135f0c3ed78dabb27b8f82985d1362 Mon Sep 17 00:00:00 2001 From: Jordan Nelson Date: Mon, 13 May 2024 17:01:55 -0400 Subject: [PATCH 2/4] chore: remove dup notification fragments --- .../notification-lifecycle.mdx | 31 ------------------ .../notification-opened.mdx | 32 ------------------- .../notification-received.mdx | 32 ------------------- 3 files changed, 95 deletions(-) delete mode 100644 src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-lifecycle.mdx delete mode 100644 src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-opened.mdx delete mode 100644 src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-received.mdx diff --git a/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-lifecycle.mdx b/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-lifecycle.mdx deleted file mode 100644 index de93ce05351..00000000000 --- a/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-lifecycle.mdx +++ /dev/null @@ -1,31 +0,0 @@ -## Notification lifecycle - -Before delving into details about the various functions Amplify provides, it can be helpful to better understand the lifecycle of a notification as it moves through your app in its various states once you've integrated Amplify Push Notifications. - -For the purposes of this guide, we will simplify the terminology as follows - -import terminology from '/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/terminology.mdx'; - - - -### In a foreground state - -![Chart of the foreground state lifecycle](/images/push-notifications/cross-platform-lifecycle/pn-lifecycle-foreground.png) - -- Notifications are not displayed when received in foreground -- It is possible for notifications to arrive in your user's notification center but not be opened until a later time -- Since it is possible to interact with the notification center at any time on a device, your user could even open a notification while your app is in the active foreground - -### In a background state - -![Chart of the background state lifecycle](/images/push-notifications/cross-platform-lifecycle/pn-lifecycle-background.png) - -- _Notification A_ represents an example of a notification which was received but never interacted with -- Recall that, in a background state, your app is still running and therefore does not need to be launched — only brought back into the foreground - -### In a terminated state - -![Chart of the terminated state lifecycle](/images/push-notifications/cross-platform-lifecycle/pn-lifecycle-terminated.png) - -- _Notification A_ represents an example of a notification which was received but never interacted with -- Recall that, in a terminated state, your app is no longer running and therefore needs to be launched diff --git a/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-opened.mdx b/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-opened.mdx deleted file mode 100644 index b91abb22fc5..00000000000 --- a/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-opened.mdx +++ /dev/null @@ -1,32 +0,0 @@ -## Respond to a notification being opened - -When a user taps on a notification displayed on their device, your app will be either launched or brought to the foreground. Knowing the contents of the notification the user interacted with can help you take further action (e.g. follow a deep link) or glean additional insight into your user engagement. - -To help you with this, Amplify provides two ways of handling notifications being opened. It is recommended that you handle both to ensure your users the most consistent and seamless experience. - -| App state | Handle with | -| :---------------------: | :---------------------: | -| Foreground / Background | `onNotificationOpened` | -| Terminated | `getLaunchNotification` | - -### onNotificationOpened - -Add `onNotificationOpened` listeners to respond to a push notification being opened while your app is in a foreground **or** background state. - -import onNotificationOpened from '/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/on-notification-opened.mdx'; - - - -### getLaunchNotification - -When your app is launched from a terminated state, you must call `getLaunchNotification` to obtain the notification which launched your app. - -Calling `getLaunchNotification` _consumes_ the launch notification and will yield a `null` result if: - -- You called it more than once (i.e. subsequent calls will be `null`) -- Another notification was opened while your app was running (either in foreground or background) -- Your app was brought back to the foreground by some other means (e.g. user tapped the app icon) - -import getLaunchNotification from '/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/get-launch-notification.mdx'; - - diff --git a/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-received.mdx b/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-received.mdx deleted file mode 100644 index 9e38c559b18..00000000000 --- a/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/notification-received.mdx +++ /dev/null @@ -1,32 +0,0 @@ -## Respond to a notification being received - -Push notifications received by your users are useful engagement tools but they also provide a data delivery mechanism to your app! - -Your app will likely need to respond to notifications being received in different ways depending on its state, namely while it is either actively in the foreground (where your app may respond by updating UI) or not (where your app may respond by performing tasks to ensure your app experience is up to date). - -| App state | Handle with | -| :---------------------: | :----------------------------------: | -| Foreground | `onNotificationReceivedInForeground` | -| Background / Terminated | `onNotificationReceivedInBackground` | - -### Notification received in foreground - -Notifications received while your app is in the foreground state do not get displayed. But their contents may be useful for updating your app (e.g. updating the UI to reflect a new inbox message). - -Add `onNotificationReceivedInForeground` listeners to respond to a push notification being received while your app is in a foreground state. - -import onForegroundNotification from '/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/on-foreground-notification.mdx'; - - - -### Notification received in background - -You may be able to improve your users' experience by having your app perform tasks in the background (e.g. fetching data) so they will have the most up-to-date experience when they next launch your app. - -Add `onNotificationReceivedInBackground` listeners to respond to a push notification being received while your app is in a background **or** terminated state. - -For background notifications to be handled while your app is terminated, it is important to note: - -import onBackgroundNotification from '/src/fragments/lib-v1/push-notifications/react-native/interact_with_notifications/on-background-notification.mdx'; - - From 3ceeceff39cd843cc33a0e5f2190044c19a6ebdd Mon Sep 17 00:00:00 2001 From: Jordan Nelson Date: Mon, 13 May 2024 17:32:09 -0400 Subject: [PATCH 3/4] chore: remove `/lib/` references --- .../getting_started/20_cli_resources.mdx | 4 +- .../getting_started/apns-cli-resources.mdx | 48 +++++++++++++++++++ .../getting_started/20_cli_resources.mdx | 4 +- 3 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 src/fragments/lib-v1/push-notifications/ios/getting_started/apns-cli-resources.mdx diff --git a/src/fragments/lib-v1/push-notifications/flutter/getting_started/20_cli_resources.mdx b/src/fragments/lib-v1/push-notifications/flutter/getting_started/20_cli_resources.mdx index 816d648b94d..9ef1caf4bce 100644 --- a/src/fragments/lib-v1/push-notifications/flutter/getting_started/20_cli_resources.mdx +++ b/src/fragments/lib-v1/push-notifications/flutter/getting_started/20_cli_resources.mdx @@ -1,7 +1,7 @@ -import apnsCliResources from '/src/fragments/lib/push-notifications/ios/getting_started/apns-cli-resources.mdx'; +import apnsCliResources from '/src/fragments/lib-v1/push-notifications/ios/getting_started/apns-cli-resources.mdx'; @@ -10,7 +10,7 @@ Upon completion, `amplifyconfiguration.dart` will be updated to reference the ne -import fcmCliResources from '/src/fragments/lib/push-notifications/android/getting_started/fcm-cli-resources.mdx'; +import fcmCliResources from '/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-cli-resources.mdx'; diff --git a/src/fragments/lib-v1/push-notifications/ios/getting_started/apns-cli-resources.mdx b/src/fragments/lib-v1/push-notifications/ios/getting_started/apns-cli-resources.mdx new file mode 100644 index 00000000000..d207f6c5a53 --- /dev/null +++ b/src/fragments/lib-v1/push-notifications/ios/getting_started/apns-cli-resources.mdx @@ -0,0 +1,48 @@ +Choose _APNS_ when promoted: + +```console +? Choose the push notification channel to enable. +❯ APNS |  Apple Push Notifications + FCM | » Firebase Push Notifications + In-App Messaging + Email + SMS +``` + +Follow the setup prompts: + + + +Authorizing the app for analytics events is crucial for unauthenticated users, particularly if you intend to configure Amplify or send push notifications to your users before their authentication. If authorization is declined, please keep in mind that updating the Cognito user pool would become necessary, and any subsequent updates could potentially result in the deletion of the current user data. + + + +```console +? Provide your pinpoint resource name: › [pinpoint_resource_name] +? 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) +``` + +Choose _Certificate_ when promoted: + +```console +? Choose authentication method used for APNs +> Certificate +Key +``` + +The CLI will prompt for your _p12 certificate path_, enter a path relative to the location where you ran the command. + + + + +Note: If you receive this error: +```console +🛑 Command failed: openssl pkcs12 -in [path_to_your_cert].p12 -out [output_path].pem -nodes -passin pass: +Error outputting keys and certificates +``` + +Please try using LibreSSL 3.3.6 instead of OpenSSL. [See issue #12969](https://github.com/aws-amplify/amplify-cli/issues/12969) + + \ No newline at end of file diff --git a/src/fragments/lib-v1/push-notifications/react-native/getting_started/20_cli_resources.mdx b/src/fragments/lib-v1/push-notifications/react-native/getting_started/20_cli_resources.mdx index 5119fcd55c4..3c8ce6fa6dd 100644 --- a/src/fragments/lib-v1/push-notifications/react-native/getting_started/20_cli_resources.mdx +++ b/src/fragments/lib-v1/push-notifications/react-native/getting_started/20_cli_resources.mdx @@ -1,7 +1,7 @@ -import apnsCliResources from '/src/fragments/lib/push-notifications/ios/getting_started/apns-cli-resources.mdx'; +import apnsCliResources from '/src/fragments/lib-v1/push-notifications/ios/getting_started/apns-cli-resources.mdx'; @@ -10,7 +10,7 @@ Upon completion, `aws-exports.js` will be updated to reference the newly provisi -import fcmCliResources from '/src/fragments/lib/push-notifications/android/getting_started/fcm-cli-resources.mdx'; +import fcmCliResources from '/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-cli-resources.mdx'; From 2f24629583b6d42a21305b2f0b87e6acbb76e6f7 Mon Sep 17 00:00:00 2001 From: Jordan Nelson Date: Mon, 13 May 2024 17:40:56 -0400 Subject: [PATCH 4/4] chore: update references to `prev` --- .../android/getting_started/fcm-cli-resources.mdx | 2 +- .../android/getting_started/fcm-pre-req.mdx | 2 +- .../android/setup_push_service/setup-fcm.mdx | 2 +- .../common/getting_started/getting-started.mdx | 2 +- .../flutter/getting_started/20_cli_resources.mdx | 4 ++-- .../flutter/identify_user/10_get_auth_user.mdx | 2 +- .../push-notifications/ios/getting_started/apns-pre-req.mdx | 2 +- 7 files changed, 8 insertions(+), 8 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 8195fee2895..2a42b844f3e 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]/build-a-backend/push-notifications/set-up-push-service/). +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/). diff --git a/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-pre-req.mdx b/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-pre-req.mdx index 3f64063726f..b562aafc0b2 100644 --- a/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-pre-req.mdx +++ b/src/fragments/lib-v1/push-notifications/android/getting_started/fcm-pre-req.mdx @@ -1 +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](/gen1/[platform]/build-a-backend/push-notifications/set-up-push-service/) for more information. +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](/gen1/[platform/prev/build-a-backend/push-notifications/set-up-push-service/) for more information. 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 edc9bc883dc..155f8dc74df 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 @@ -25,4 +25,4 @@ Next, you will need to access your **ServerKey** (Referred to as **ApiKey** in t ![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]/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..830a0163b2f 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 @@ -22,7 +22,7 @@ To use Push Notifications with Amplify, you have the option to either have the A -> Prerequisite: [Install and configure the Amplify CLI](/gen1/[platform]/tools/cli/start/set-up-cli/) +> Prerequisite: [Install and configure the Amplify CLI](/gen1/[platform]/prev/tools/cli/start/set-up-cli/) diff --git a/src/fragments/lib-v1/push-notifications/flutter/getting_started/20_cli_resources.mdx b/src/fragments/lib-v1/push-notifications/flutter/getting_started/20_cli_resources.mdx index 9ef1caf4bce..2bbd0015fc0 100644 --- a/src/fragments/lib-v1/push-notifications/flutter/getting_started/20_cli_resources.mdx +++ b/src/fragments/lib-v1/push-notifications/flutter/getting_started/20_cli_resources.mdx @@ -5,7 +5,7 @@ import apnsCliResources from '/src/fragments/lib-v1/push-notifications/ios/getti -Upon completion, `amplifyconfiguration.dart` 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](/gen1/[platform]/start/project-setup/prerequisites/). +Upon completion, `amplifyconfiguration.dart` 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](/gen1/[platform]/prev/start/project-setup/prerequisites/). @@ -14,7 +14,7 @@ import fcmCliResources from '/src/fragments/lib-v1/push-notifications/android/ge -Upon completion, `amplifyconfiguration.dart` 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](/gen1/[platform]/start/project-setup/prerequisites/). +Upon completion, `amplifyconfiguration.dart` 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](/gen1/[platform]/prev/start/project-setup/prerequisites/). diff --git a/src/fragments/lib-v1/push-notifications/flutter/identify_user/10_get_auth_user.mdx b/src/fragments/lib-v1/push-notifications/flutter/identify_user/10_get_auth_user.mdx index fab245ea0bd..75fd531ef97 100644 --- a/src/fragments/lib-v1/push-notifications/flutter/identify_user/10_get_auth_user.mdx +++ b/src/fragments/lib-v1/push-notifications/flutter/identify_user/10_get_auth_user.mdx @@ -1,4 +1,4 @@ -If the user is signed in through [Amplify.Auth.signIn](/gen1/[platform]/build-a-backend/auth/enable-sign-in/), then you can retrieve the current user's ID as shown below: +If the user is signed in through [Amplify.Auth.signIn](/gen1prev/build-a-backend/auth/enable-sign-in/), then you can retrieve the current user's ID as shown below: ```dart final user = await Amplify.Auth.getCurrentUser(); diff --git a/src/fragments/lib-v1/push-notifications/ios/getting_started/apns-pre-req.mdx b/src/fragments/lib-v1/push-notifications/ios/getting_started/apns-pre-req.mdx index 40444fbf35c..d7f1d9b0e50 100644 --- a/src/fragments/lib-v1/push-notifications/ios/getting_started/apns-pre-req.mdx +++ b/src/fragments/lib-v1/push-notifications/ios/getting_started/apns-pre-req.mdx @@ -1,4 +1,4 @@ -Push Notifications are delivered via the Apple Push Notification service (APNs). In order to use APNs, you need to setup credentials (keys or certificates) and export your credentials to a p12 file. See [Setting up push notification services](/gen1/[platform]/build-a-backend/push-notifications/set-up-push-service/) for more information. +Push Notifications are delivered via the Apple Push Notification service (APNs). In order to use APNs, you need to setup credentials (keys or certificates) and export your credentials to a p12 file. See [Setting up push notification services](/gen1/[platform]/prev/build-a-backend/push-notifications/set-up-push-service/) for more information.