I am trying to setup up push notifications in my Ionic 3 app.
I am using the AWS pinpoint service to build campaigns and push messages to devices. Specifically iOS devices.
I have the backend setup and I can track devices using Pinpoint analytics console.
I have added the push plugin to my Iconic app, and I am able to request permission to receive push notifications. I have signed my app with a cert and also setup AWS with a cert, so as far as I know all the pieces are in place on the backend.
I can debug the Ionic app and grab the device token, eg
pushObject.on('registration').subscribe((registration: any) => {
console.debug("Device Token:", registration.registrationId);
});
I can use this token in the AWS Pinpoint console, Direct messaging to send and successfully receive a APNS message on the test device.
My question is, how do I register the token with AWS for use in campaigns?
Furthermore my Pinpoint console shows no targetable endpoints , which is what I believe I need to setup from my Ionic app, but I can't find any examples anywhere.
All help greatly received....
Lee
You can use Analytics.updateEndpoint request to add your device to pinpoint when not using the Amplify Push Notifications module (non-react-native). Update the Address
property with that device token:
const config = {
Address: token,
OptOut: 'NONE'
};
Analytics.updateEndpoint(config).then((data) => {
console.log('update endpoint success, setting token into cache');
}).catch(e => {
console log('update endpoint failed', e);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.