Issue
I'm working with Ionic3 and using FirebaseX Cordova Plugin (because firebase plugin it's not working at all) and when the App is foreground (opened) the message get in the App (not as a notification) perfect, but when in background (using another app) the notification don't show... when I open back the App, the message get in the App (not as a notification)...
I'm using the Author example EXACTLY (only changed the bundle id so I could register as a Firebase Project)
I use a paid developer account, I have defined a APN, uploaded to firebase etc.
Activate the Remote Notification in Capabilities (both on Push and Background)
But still...
Something strange is that when the App opens, it says in the log:
2019-10-25 11:20:50.152424-0300 FirebaseX Ionic 3 Example[560:180512] FCM direct channel = true
and when the App goes background, the login says:
2019-10-25 11:20:50.152424-0300 FirebaseX Ionic 3 Example[560:180512] FCM direct channel = false
And when I open the App again it goes back to true again, and receive the notification!
I know that FCM is Firebase Cloud Messagin, so... but I don't know why it turns false
Please, help! Thanks!
Solution
I found the solution! Maybe it helps someone... Now with the FirebaseX Cordova Plugin You need to ask for permission explicitly (with the old firebase cordova plugin, was automaticly asked...)
insert this code:
this.firebasePlugin.grantPermission(function(hasPermission){
console.log("Permission was " + (hasPermission ? "granted" : "denied"));
});
and that's it (if the user say 'yes'!)
Answered By - Ari Waisberg
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.