Open JaneDawson opened 7 years ago
What is the catch error coming up with? You use node I guess... https://firebase.google.com/docs/cloud-messaging/admin/send-messages
admin.messaging().sendToDevice(registrationToken, payload)
.then(){
})
.catch(error) {
console.log(error)
}
Another thing, you may not delete the token ever but update it onTokenRefresh, code i use in a ionic 1 app.
FCMPlugin.onTokenRefresh(function(token){
$scope.Token = token;
$scope.clickedSubscribe();
});
1) Unfortunately, the .catch
is not coming up with anything. As I said, there is no error returned at all.
2) I'm using onTokenRefresh
.as well. However, I decided to delete the token on logout, since then my app knows if any user is currently signed on with at least one device (1+ device tokens in DB) or not (no device token in DB). If user is not signed on at all, I don't want to send him push notifications.
Nobady an idea? Shouldn't I receive an error in case the app was uninstalled by the user (as it's suggested by firebase)?
I use the cordova-plugin-fcm for my Ionic 3 app. Thank you for this great plugin.
However, I'm experiencing the following issue and hope you can help figuring out how to solve it. Whenever a user logs in, I store the device token in my database using
FCMPlugin.getToken()
. When he logs out, I delete the token from my database. When a user logs in and then decides to uninstall the app without logging out first, I don't know about the uninstallation and still have the (invalid) token in my database.When I send a push notification to this invalid device token using Firebase's
sendToDevice()
function, I expect to get an error like the firebase errormessaging/registration-token-not-registered
(see here). However, there is no error returned at all, even if the app was uninstall more than a day ago.How can I receive error messages to know that the token is invalid?