I'm submitting a ... (check one with "x")
If you choose 'problem or bug report', please select OS: (check one with "x")
Whenever I call map.getMyLocation() on ios (and I have location services turned off) a popup window comes up telling me to go to settings and enable them. As I would like to control what happens in the flow of my app if location services are not enabled, is there a way to disable that popup?
This plugin does not show up any popup.
Map.getMyLocation() is an alias of LocationService.getMyLocation().
https://github.com/mapsplugin/cordova-plugin-googlemaps/blob/master/www/LocationService.js
https://github.com/mapsplugin/cordova-plugin-googlemaps/blob/master/src/ios/GoogleMaps/PluginLocationService.m
Can you find any alert() dialog, or any popup command in the source code?
The message in the dialog is the one found here:
"LOCATION_IS_UNAVAILABLE_ERROR_TITLE" : "Location Service is not available",
"LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE" : "This app needs to access your location. Please turn on \"Settings > Privacy > Location Services\"",
And yes I can find the the alert in PluginLocationService.m
NSString *LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE = [PluginUtil PGM_LOCALIZATION:@"LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE"];
UIAlertController* alert = [UIAlertController alertControllerWithTitle:LOCATION_IS_UNAVAILABLE_ERROR_TITLE
message:LOCATION_IS_UNAVAILABLE_ERROR_MESSAGE
preferredStyle:UIAlertControllerStyleAlert];
Ah, I see. I forgot it.
However, the alert dialog is useful for most people.
Well, please use other geolocation plugin, such as cordova-geolocation-plugin
That's what I ended up opting for, but in the spirit of trying to lighten the load of the app (more plugins = more load time), may I suggest in a future version of maps plugin that you can pass an additional key in the LocationOptions, (maybe showUnavailablePrompt: true/false) and let the developer decide if they want to use this feature.
I would fork and create a pull request for it, but I'm afraid I don't know how to code for ios
How about creating a new method, such as LocationService.hasPermission()?
That would be even better. Can this work both for ios and android?
Done
Wow that was fast!!!!
Most helpful comment
https://github.com/mapsplugin/v2.0-demo/blob/master/www/LocationService/hasPermission.html