I've implemented FireBaseX in my Ionic 4 app to send remote notifications.
this.platform.ready().then(() => {
let platforms = this.platform.platforms();
if(platforms.includes('ios') || platforms.includes('android') || platforms.includes('mobile')){
this.firebase.getToken().then(token => {
console.log(`FIREBASE TOKEN ${token}`);
if(platforms.includes('ios')) this.firebase.grantPermission();
});
this.firebase.onMessageReceived().subscribe(data => {
console.log('FIREBASE MESSAGE', data);
});
}
});
So when I open the app in iOS, it asks for permissions correctly.
Then I send test message and the console.log() appears correctly.
2020-02-05 17:35:38.282123-0300 Parkaz[86464:2354851] didReceiveMessage: {
"collapse_key" = "com.myapp.app";
from = 678323471xxxx;
notification = {
body = teste;
e = 1;
tag = "campaign_collapse_key_5659280550157990837";
title = teste;
};
}
However, if the app is not opened, nothing happens. The notification banner doesn't appear, no badge, no sound... nothing...
Am I doing something wrong?
Hello have you prepare all the certs?
Please build and run the example project to verify your APNS configuration in Firebase and as a reference for a known working codebase.
Got same problem with example project.
Here's a short video: https://drive.google.com/open?id=1tBnqveAxzfnlKVdLyNl1VqqUO7VnFbOP
From your video, I can see when the app is in the foreground it's receiving the notification message as a data message. This implies it's being received via the didReceiveMessage delegate which Firebase uses if APNS is unavailable so it can't receive the message via the didReceiveRemoteNotification delegate.
This would suggest your APNS configuration is not working. Please ensure you've configured APNS in the Firebase console as instructed and that the app ID is correctly configured to use APNS in the Apple Member Center.
oh I missed the APNS configuration in Firebase settings.
adding p12 APNS certificates to firebase made it works in iOS!
does it have a similar process to Android?
In Android the same problem persists...
Checking some online examples, I see a code block subscribeToTopic()... is it a must to subscribe topics in android platform?
@leabdalla @dpa99c The same is happening with me, I have followed all the steps like provisioning profiles, AuthKey on firebase etc. all, but still the same is happening to me, using plugin 8.0.1, iOS 5.1.1
Most helpful comment
From your video, I can see when the app is in the foreground it's receiving the notification message as a data message. This implies it's being received via the
didReceiveMessagedelegate which Firebase uses if APNS is unavailable so it can't receive the message via thedidReceiveRemoteNotificationdelegate.This would suggest your APNS configuration is not working. Please ensure you've configured APNS in the Firebase console as instructed and that the app ID is correctly configured to use APNS in the Apple Member Center.