Closed Sampath-Lokuge closed 5 years ago
I have exactly the same problem with Ionic4; there is no tap property for iOS. I've also set notification_foreground: 'true', but it doesn't show the native notification. In Android it works well.
Config:
"cordova": "^9.0.0",
"cordova-android": "8.0.0",
"cordova-ios": "5.0.1",
"cordova-plugin-firebasex": "6.0.6",
Hi ! I had the same problem. Looking at the logs I noticed that in the didReceiveRemoteNotification () method the TAP variable was not instantiated.
This piece of code must be added to the AppDelegate+FirebasePlugin.m file at line 150:
NSString* tap;
if([self.applicationInBackground isEqual:[NSNumber numberWithBool:YES]]){
tap = @"background";
}else{
tap = @"foreground";
}
[mutableUserInfo setValue:tap forKey:@"tap"];
if([mutableUserInfo objectForKey:@"messageType"] == nil){
[mutableUserInfo setValue:@"notification" forKey:@"messageType"];
}
I can confirm the problem.
@papattes solution fixes the problem.
@papattes Can't you create a PR for your solution?
@Sampath-Lokuge I created it, however, it added it on the arnesson/cordova-plugin-firebase repo. When I click that new PR, I am redirected automatically to this repository. How to do ?
Hi,
There is no
tap
property on iOS device background use case. Hence it shows the notification 2 times. i.e. it always fires// Received in foreground
section onfcmListeners()
method. i.e. it shows system tray notification and custom notification where I have created for a foreground use case.Note: Here I use firebase console dashboard to send the push. i.e. no API call
FCM dashboard custom property: https://imgur.com/cE9Yxwk
Note: No issues on the
Killed
use case. i.e. it doesn't fire the custom notification. only the system tray notification shows. This is the behavior where I needbackground
use case too.Note: No issues on Android device. i.e. it works fine on all 3 use cases.
service.ts
app.componet.ts
package.json
"cordova-plugin-firebasex": "^6.0.7",
ionic info
This is the payload comes when taps the system notification. i.e. it always goes to the
// Received in foreground
section onfcmListeners()
method.