Does Amplify AWS not generate device token on V6 for Push Notification?
According to the latest documentation of Aws Amplify V6 ,to generate token we have to use onTokenReceived from aws-amplify/push-notification for implementing push-notifications on Mobile using react-native
const myTokenReceivedHandler = (token) => { console.log("Push token received in Dashboard:", token); await identifyUser({ userId: attributes.sub, options: { optOut: "NONE", address: token, }, }); };
const listener = onTokenReceived(myTokenReceivedHandler); return () => listener.remove(); }, []); But this never gets executed,and I donn receive any token . I am using Firebase-messaging/app package to get token and the using identifyUser from aws-amplify/push-notification to register token to endpoint.
const fcmToken = await messaging().getToken(); console.log("FCM token from Firebase:", fcmToken); await identifyUser({ userId: attributes.sub, options: { optOut: "NONE", address: fcmToken, }, }); This works and I am getting push-notifications but I want to achieve this using Amplify .It was working fine in V5 but after migrating to V6 I am not able to get tokens Please suggest what i am doing wrong .
Hey @itmsroohim , thanks for reporting this issue! i'll try to reproduce this and get back to you. In the meantime, are you using a new endpoint for push notifications? Amazon Pinpoint is deprecated and I'm wondering if this is a result of that.