-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS system dialog asking "turn on location services" does not fire cordova pause or resume events #60
Comments
This is the expected behaviour on iOS. The system dialog is shown as a UIAlert window in the view hierarchy of the application which made the request, hence the application never gets paused or therefore resumed when the dialog is shown. Only if the user pressing the "Settings" button which opens the Settings app on the Location Services page does the app which requested the dialog get paused in the background. |
Thanks for your fast reply. So can there be a callback when the user presses the 'Cancel' button? Otherwise the app has no way to know if anything happened effectively freezing it! |
Unfortunately there's no way to create a callback since the native iOS system dialog doesn't provide any mechanism for this - we are limited by the functionality which Apple has deemed fit to give us. The best you can do is to set a timeout before invoking the system dialog which re-checks if Location Services is on via |
Ok, thanks for your great advice. |
I'm submitting a bug report.
My iOS (cordova 4.1, iOS 11) app calls
cordova.plugins.locationAccuracy.request(function (success){ console.log("Successfully requested accuracy: "+success.message); }
The iOS system dialog appears asking "Turn on Location Services to Allow to Determine Your Location". I have registered event handlers for 'pause' and 'resume'. But the 'pause' event is not fired when the native iOS dialog appears. Why not?
Also, when I click 'Cancel' the 'resume' event does not fire. Why not? Is the app not actually put in the background so the pause event doesn't fire?
The pause event is fired when the dialog appears or when the 'cancel' button is pressed and the app is brought to the foreground. The 'resume' event is fired when the 'cancel' button is pressed.
Environment information:
Cordova CLI 7.0.1
Cordova iOS 4.1
iOS 11
cordova-plugin-request-location-accuracy version 2.2.3
Other plugins:
cordova-labs-local-webserver 2.4.0 "CordovaLocalWebServer"
cordova-labs-wkwebview-engine-localhost 0.5.0 "Cordova WKWebView Engine with http server (localhost) support"
cordova-plugin-camera 2.2.0 "Camera"
cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-console 1.0.7 "Console"
cordova-plugin-device 1.1.2 "Device"
cordova-plugin-dialogs 1.2.1 "Notification"
cordova-plugin-email-composer 0.8.3 "EmailComposer"
cordova-plugin-facebook4 1.4.1 "Facebook Connect"
cordova-plugin-file 3.0.0 "File"
cordova-plugin-geolocation 2.0.1-dev "Geolocation"
cordova-plugin-http 1.1.0 "SSL Pinning"
cordova-plugin-inappbrowser 1.1.2-dev "InAppBrowser"
cordova-plugin-media 1.0.1 "Media"
cordova-plugin-network-information 1.1.0 "Network Information"
cordova-plugin-request-location-accuracy 2.2.3 "Request Location Accuracy"
cordova-plugin-screensize 1.3.1 "screensize"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.1 "StatusBar"
cordova-plugin-wkwebview-engine 1.1.3 "Cordova WKWebView Engine"
cordova-plugin-x-socialsharing 5.0.8 "SocialSharing"
cordova.plugins.diagnostic 3.9.2 "Diagnostic"
ionic-plugin-keyboard 1.0.8 "Keyboard"
org.apache.cordova.startapp 0.3.0 "startApp"
phonegap-plugin-push 1.5.2 "PushPlugin"
Mac OS 10.14.1
XCode 10.1
iPhone 8, running iOS 11
Related code:
cordova.plugins.locationAccuracy.request(function (success){ console.log("Successfully requested accuracy: "+success.message); }
Console output when opening the native iOS dialog:
locationManager::didFailWithError (null)
Console output when pressing 'cancel' button:
active PushPlugin skip clear badge
The text was updated successfully, but these errors were encountered: