banner 728x90

AWS Amplify adds support for push notifications in React Native and offers new functions for user authentication

banner 728x90

AWS Amplify is a declarative JavaScript library for working with cloud services. It has built-in support for creating React Native applications. For push notifications in React Native, AWS Amplify introduces an easy-to-use client API and back-end configuration via AWS Mobile Hub. The latest version of the AWS Amplify JavaScript library has been extended to support push notifications in React Native and includes improvements for user authentication.

Enable push notifications for React Native apps includes configuring the backend, configuring your app and processing notifications in your code with the Push Notification API.

Configuring the backend with Mobile Hub

Push notifications are generated by push notification services such as the Apple Push Notification (APN) service for iOS, Firebase Cloud Messaging (FCM) for Android and Amazon Device Messaging (ADM) for Amazon devices. You can use AWS Mobile Hub and Amazon Pinpoint to orchestrate those services and send push notifications to any mobile device, without trading in your app with SDKs from multiple vendors.

Follow these steps to enable push notifications in your app:

  • Register your app with the platform push notification system (APN & # 39; s, FCM or ADM). Keep the registration keys and credentials for use in the following steps.
  • Add & # 39; Messaging and Analytics & # 39; to your project in Mobile Hub.
  • Update the push notification credentials for the related reporting services in Mobile Hub.
  • Mobile Hub automatically takes care of the AWS resources your app needs. An Amazon Pinpoint project is created and integrated into the back-end of your app.

aws amplify adds support for push notifications in react native and offers new functions for user authentication - AWS Amplify adds support for push notifications in React Native and offers new functions for user authentication

You can later create campaigns for mobile push notifications in the Amazon Pinpoint console. See the Amazon Pinpoint User Guide for more information on working with Amazon Pinpoint campaigns.

Configuring your native Native app

To receive and process notifications on mobile devices, you must also configure your application. For iOS and Android the required configuration parameters are different. Follow the installation instructions for notifications in the AWS Amplify notification installation guide.

Tests and tracking notifications

After building your React Native app with the required configuration, you are ready to send and receive notifications in your app. With the Amazon Pinpoint console you can create push message campaigns, where you can send messages directly or plan for later.

When you receive notifications in your app, AWS Amplify offers two handlers that you can deploy and use to add custom behavior. The following code sample displays the payload of the notification on an Android device.

  PushNotification.onNotification (data => );

PushNotification.onRegister (data => );  
banner 728x90
author
Author: 
    Build a user settings store with AWS AppSync
    Build a user settings store with AWS AppSync
    Amazon Cognito Sync is a service that
    Synchronize user settings for Android with AWS AppSync
    Synchronize user settings for Android with AWS AppSync
    Amazon Cognito Sync is a service that
    Script & Style Show: Episode 10: Dojo
    Script & Style Show: Episode 10: Dojo
    In this episode welcome David and Todd

    Leave a reply "AWS Amplify adds support for push notifications in React Native and offers new functions for user authentication"

    Must read×

    Top