Skip to content
This repository has been archived by the owner on Mar 18, 2020. It is now read-only.

amazon-archives/aws-pinpoint-sample

This Repo is no longer valid with AWS Mobile Hub. To enable Push Notifications in your React Native app use AWS Amplify with Push Notifications and Analytics with Amazon Pinpoint.


AWS Pinpoint Sample App

A React Native mobile app that utilizes AWS Mobile Hub and AWS Native Mobile SDK. Just generate your Mobile Hub Package and drop it into the android package. The Configuration is update-able via JavaScript configuration using React Native Modules.

This app has an accompanying blog post located here

Requirements

Setup Mobile Hub Project

Go to the AWS Mobile Hub console and create a new app. For this tutorial, enter the name PinpointSample then click Create Project. In the list of features, choose Cloud Logic and then choose Create new API. Give the API a name PinpointSampleApi and a description, leave the defaults, and choose Create API.

Next, in the AWS Mobile Hub console, choose User Engagement, then choose Enable engagement, select Android and enter your Sender ID and Legacy API Keys for the Android Platform. Click Save changes then choose Integrate with your app. Next choose the Android tab, and then choose Download package.

Extract the amazonaws folder from Mobile Hub package archive to android/app/src/main/java/com/amazonaws.

For JavaScript to be able to update the AWS configuration dynamically, you will need to update the AWSConfiguration.java file and remote the final from the variables. Finally, you can update the configuration values in index.android.js with the values pre-populated in the AWSConfiguration class:

AWSMobileHub.initializeApplication(
  // Cognito ID Pool
  '<<your-id-pool-id>>',
  // Pinpoint (previously Mobile Analytics) Application ID
  '<<app-id>>',
  // GCM Sender ID
  '<<your-sender-id>>',
  // AWS Region
  '<<your-region>>'
)

Running the Application

Once you've added your Mobile Hub package and updated the JavaScript configuration, connect a device and run:

react-native run-android

You can use the included logcat.sh bash script (on mac or linux) to filter the log statements in the terminal:

chmod +x logcat.sh
./logcat.sh

If you are on windows

logcat

License

This sample code is made available under the MIT-0 license. See the LICENSE file.

About

Targeted push notifications and campaign management using Amazon Pinpoint and React Native

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published