3

I have followed official AWS Pinpoint guide, and I was not able to receive Push notification on my device.

My steps:

  1. My Firebase project configured correctly, I was able to receive push notification from Firebase console

  2. I enabled Push notifications in AWS Pinpoint console and added API key and Sender ID there

  3. I did these commands in the project:

npm install @aws-amplify/pushnotification --save
react-native link @aws-amplify/pushnotification

  1. Added configuration for analytics and push notifications in App.js
Amplify.configure({

    Auth: {
        region: 'xxx',
        userPoolId: 'xxx',
        userPoolWebClientId: 'xxx',
        mandatorySignIn: true
    },
    API: {
        endpoints: [{
            name: "xxx",
            endpoint: "xxxx",
            custom_header: async () => ({ Authorization: await getAuthorizationToken() })
        }]
    },
    Analytics: {
      disabled: false,
      AWSPinpoint: {
        appId: 'xxxxxx',
        region: 'xxxx',
      }
    }
});

PushNotification.configure({
  appId: 'xxxx',
  region: 'xxxx',
}); 
  1. Added in componentDidMount in App.js method onRegister:
componentDidMount(){
  PushNotification.onRegister((token) => {
    console.log('in app registration', token);
  });
}
  1. After Sign In added this updateEndpoint method:
Analytics.updateEndpoint({
  address: 'xxxx',
  channelType: 'GCM',
  userId: '1',
}) 
  1. I was trying to create Test campaign in AWS Pinpoint console, but console didn't see any devices and didn't send anything to the phones.

What I'm missing? How to make it work?

Lucky_girl
  • 4,543
  • 6
  • 42
  • 82

0 Answers0