I'm building React Native App. I have used a react-native-notification library to add the Notification features.
My Andriod app can generate token and received notifications from firebase but for iOS app, the token is generated but when a message is sent to this token id nothing happened instead I am getting an error.
"error": "InvalidRegistration"
await NotificationsIOS.addEventListener('remoteNotificationsRegistered', onPushRegistered);
await NotificationsIOS.addEventListener('remoteNotificationsRegistrationFailed', onPushRegistrationFailed);
await NotificationsIOS.requestPermissions();
function onPushRegistered(deviceToken) {
// TODO: Send the token to my server so it could send back push notifications...
console.log("Device Token Received", deviceToken);
}
I used this code to get Device Token on iOS the token is generating but i think it is not a vlaid FCM token. 45f41b17e16b5970fe35.......8222b01289580bae87ba35d2b2bc72b
{
"data": {
"title": "sample Title",
"content": "sample text",
"key": "Im the key"
},
"to": "ce4a46370d7c4060b0a4dd.........47de821d0bc1767f124a2fa157afe"
}
But when i send the FCM message to this token id it gives me above error. I have also added the APN's certificates to the firebase. I can generate the local notifications using this library on ios and the remote andriod notification is also working properly. Kindly help me to get it fixed as i don't want to use any other library thanks.