plugin doesn't let cordova-plugin-fcm-with-dependecy-updated ^2.4.0 plugin handle notification
See original GitHub issueYour Environment
- Plugin version: 3.0.3
- Platform: iOS
- OS version: 11.0.3 and 12.3.1
- Device manufacturer and model: iPhone 6, iPhone 6s
- Running in Simulator: no
- Cordova version (
cordova -v
): 8.1.2 - Cordova platform version (
cordova platform ls
): ios 4.5.4 - Plugin configuration options:
geolocation.configure({
locationProvider: _geolocation.ACTIVITY_PROVIDER,
desiredAccuracy: _geolocation.MEDIUM_ACCURACY,
stationaryRadius: 0,
distanceFilter: 0,
debug: false,
stopOnTerminate: true,
stopOnStillActivity: false,
startForeground: true,
fastestInterval: 10000,
interval: 10000,
maxLocations: 1
}
- Link to your project:
Context
in CDVBackgroundGeolocation.m file debugger never goes into if statement
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
willPresentNotification:(UNNotification *)notification
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
if (prevNotificationDelegate && [prevNotificationDelegate respondsToSelector:@selector(userNotificationCenter:willPresentNotification:withCompletionHandler:)])
{
// Give other delegates (like FCM) the chance to process this notification
[prevNotificationDelegate userNotificationCenter:center willPresentNotification:notification withCompletionHandler:^(UNNotificationPresentationOptions options) {
completionHandler(UNNotificationPresentationOptionAlert);
}];
}
else
{
completionHandler(UNNotificationPresentationOptionAlert);
}
}
Expected Behavior
plugin should let others handle push data (in my case fcm, which works properly without this plugin)
Actual Behavior
debugger always choses else statement and only displays notification in upper banner, no matter if app is foreground
Steps to Reproduce
- clear project
- cordova plugin add cordova-plugin-fcm-with-dependecy-updated@^2.4.0
- cordova plugin add @mauron85/cordova-plugin-background-geolocation@3.0.3
- put breakpoint on line 484 in CDVBackgroundGeolocation.m
- send any test push from firebase console
Issue Analytics
- State:
- Created 4 years ago
- Comments:11
Top Results From Across the Web
Google FCM Push Notifications Cordova Plugin - GitHub
Google Firebase Cloud Messaging Cordova Push Plugin. Extremely easy plug&play push notification plugin for Cordova applications with Google Firebase FCM.
Read more >onNotification handler cordova-fcm-plugin-with-dependecy ...
I have implemented push notifications using the cordova-fcm-plugin-with-dependecy-updated package in my vue-cordova app.
Read more >Blog - Apache Cordova
With the new support, the plugin will be preloaded and runs in a separate context from the web app. This feature is known...
Read more >cordova-plugin-fcm-with-dependecy-updated@7.0.8
This does not include vulnerabilities belonging to this package's dependencies. Does your project rely on vulnerable package dependencies? Automatically find ...
Read more >Ionic 5, FCM plugin does not request permissions to receive ...
My iPhone (a real device) does not ask for permissions to receive push notifications on Ionic 5, cordova-plugin-fcm-with-dependecy-updated ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ProximaHaiz just in case you haven’t fix this issue yet, I solved it from my side by commenting these lines in plugins/cordova-plugin-mauron85-background-geolocation/CDVBackgroundGeolocation.m
After that Push Notifications worked as expected.
Hope this helps.
@nuno @ProximaHaiz @walfridosp @dzziwny @mauron85 I have a PR that fixes the issue https://github.com/mauron85/cordova-plugin-background-geolocation/pull/696
The problem is that it’s overriding the notification center delegate. It should only override it when it is in debugging mode. There is no need to comment out the
addObserver
lines