AngularFireModule is for initialize firebase, in case you didnt do that yet (config is a json with the api key and information of your firebase project)
Okay, I’m starting to understand! I have no more error and it seems to walk in the console but how can I test? I try to put my own token to receive the notification but as I am already in the app I can not test …!
And two other things if it’s not too much … Thank you very much already! How do I get notifications when the app is not open at all? And how do we add a small badge on the application icon when we receive one?
in the firebase console, inside grow - notifications you can send notifications with the user token for testing.
this function in FCM act like a listener so you can set up a specefic behaviour when you open the app through a notification:
FCMPlugin.onNotification(function(data){
if(data.wasTapped){
//Notification was received on device tray and tapped by the user.
alert( JSON.stringify(data) );
}else{
//Notification was received in foreground. Maybe the user needs to be notified.
alert( JSON.stringify(data) );
}
});
in android, when the app is launched the first time and then you close it , the app is still listening for notifications.
the badge in the app icon i think depends on the android version and mobile?, i am not sure, i dont think is something you can do with ionic.
The notification does not appear on my mobile, like facebook ect … It just appears in the notifications bar! If I want it to appear basically I have to go on my mobile in the notifications options of this application and add the options to make it appear at wholesale
Should i use //FCMPlugin.onTokenRefresh( onTokenRefreshCallback(token) );
//Note that this callback will be fired everytime a new token is generated, including the first time.
FCMPlugin.onTokenRefresh(function(token){
alert( token );
});
the notification only appear if the app is closed or minimize, if you are inside your app you can set up an alert or something, in the else statement of “onNotification” function.
the token can be changed in any moment by firebase, the onTokenRefresh function is another listener that trigger when the token is change, so you can save it again
I mean, like on the screen behind, and me i have just the notification in the notifications bar ! But i can fix this, in the option of my device … but if all people need to go in the settings this is not fine.
@rude5446 Hi, sorry to disturb again but I really have a hard time with this notification story when the app is totally closed … I get the notifications ect perfectly when I’m on it or it’s in the background but when it’s totally close nothing at all … an idea …
I do not receive them when the application is completely closed even using the firebase send directly without method! The payload, is the method I did to send notifications from within?
This would not come from the file “MyFirebaseMessagingService.java”? I see that some people modify it!
When I say totally close I’m talking about that yes, when we do not turn on the application at all or turn it on and close forcibly
how to send notifications to all users, show error: "Notification Post Failed: Please include a case-sensitive header of Authorizathion: Basic with a valid REST PI KEY … " THANK YOU