cordova -v): 8.1.2cordova platform ls): ios 4.5.4geolocation.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
}
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);
}
}
plugin should let others handle push data (in my case fcm, which works properly without this plugin)
debugger always choses else statement and only displays notification in upper banner, no matter if app is foreground
I have the same issue.
@dzziwny Do you find a solution?
So, i just removed code, that handle notification and its solved the problem
@ProximaHaiz I used https://github.com/arnesson/cordova-plugin-firebase instead
@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
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppPause:) name:UIApplicationDidEnterBackgroundNotification object:nil];
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppResume:) name:UIApplicationWillEnterForegroundNotification object:nil];
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onFinishLaunching:) name:UIApplicationDidFinishLaunchingNotification object:nil];
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppTerminate:) name:UIApplicationWillTerminateNotification object:nil];
After that Push Notifications worked as expected.
Hope this helps.
@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
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppPause:) name:UIApplicationDidEnterBackgroundNotification object:nil]; // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppResume:) name:UIApplicationWillEnterForegroundNotification object:nil]; // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onFinishLaunching:) name:UIApplicationDidFinishLaunchingNotification object:nil]; // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppTerminate:) name:UIApplicationWillTerminateNotification object:nil];After that Push Notifications worked as expected.
Hope this helps.
Thanks, i commented these lines too)
Also if you are using this plugin or BackgroundMode plugin with sound off, remove audio key from UIBackgroundModes which located in plugin.xml file. Because App Store not allowed to publish my application with that
I have the same problem. I had to comment those lines abone too.
@mauron85 There is a way make the plugin work with all others that suport push notification, like fcm for exemple?
Thanks for you time.
Anyone? @dzziwny @ProximaHaiz @walfridosp @mauron85
Hi Nuno,
I did find a solution for this issue, I will get back to you later.
Thanks
On Fri, 6 Mar 2020 at 3:47 PM Nuno Costa notifications@github.com wrote:
Anyone? @dzziwny https://github.com/dzziwny @ProximaHaiz
https://github.com/ProximaHaiz @walfridosp
https://github.com/walfridosp @mauron85 https://github.com/mauron85—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mauron85/cordova-plugin-background-geolocation/issues/627?email_source=notifications&email_token=AC3CO3VCXTD2SDCTKBTPHLTRGDPFTA5CNFSM4IXNPTDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOBCWYA#issuecomment-595733344,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AC3CO3U22JNQ5JGVXVSI6EDRGDPFTANCNFSM4IXNPTDA
.
@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
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed, because it has not had recent activity. If you believe this issue shouldn't be closed, please reopen or write down a comment requesting issue reopening with explanation why you think it's important. Thank you for your contributions.
Most helpful comment
@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
addObserverlines