Location Permission
Loving the plugin thus far. 2 part question:
- Is there a way to control when the user is prompted with the permission dialog to share their location? Presently the prompt appears right when my app is loaded and I would like to ask them once it is necessary, when the map is being presented.
- Is there a way to only use NSLocationWhenInUseUsage and not NSLocationAlwaysUsage? Some users might be less open to have my app always tracking their location.
Thank you for the help!
-
Are you talking about Android or iOS?
-
https://github.com/transistorsoft/cordova-background-geolocation-lt
I'm talking about iOS. The image below illustrates what I'm referring to and is a rather abrupt thing to ask a user when the app initializes. Ideally I'd like to disable location services within the plugin since my app is already locating the user's position.

I guess you call map.getMyLocation() when the app is initialized.
This plugin does not request the geolocation permission automatically.
I searched across my entire project and the only areas that getMyLocation is referenced is in the plugin folder and in the platform folder both have been untouched by me.
But it appears that when I'm calling my own Geolocation function (via the cordova geolocation plugin), the permission the app is asking for is related to how the map uses geolocation. In other words, my app just asks for in app usage of the user's location but the map wants that and exterior app location permissions, since that is a greater permission ask it looks like it is defaulting to that. Is there a way to have the map without requiring location services? Thanks again for help and patience.
I'm calling my own Geolocation function (via the cordova geolocation plugin), the permission the app is asking
This is that the cordova-geolocation-plugin wants to permission to access the GPS, isn't it? If you don't getMyLocation() in your code, this plugin does not related thing.
And there is no way to get geolocation without permission asking.
Correct, I just want to ask for the same amount of permission as I did without the plugin (just in app usage). So I noticed that the plugin adds NSLocationAlwaysUsageDescription to the project's .plist . If I remove that entry from the .plist it doesn't ask for location permission outside of the app but then I get this error 2016-03-23 15:38:46.362 Servy[33343:934231] locationManager::didFailWithError (null) and geolocation doesn't work.
So actually the error was related to the simulator simulating a location. So it works now! Just to summarize when I deleted the NSLocationAlwaysUsageDescription from the .plist that specific prompt went away and only the NSLocationWhenInUseUsage prompt appeared. I assume removing <config-file target="*-Info.plist" parent="NSLocationAlwaysUsageDescription"><string>Trace your location on the map</string></config-file> will remove it from future builds. Thanks for your help.
I think if you get permission using cordova geolocation plugin, the permission should be shared with other libraries. Because the permissions are given by based on the application, not library.
Even if the app has already the permission, but the app still requests, the someone (the geolocation plugin or something) requests for some reason.
At least this plugin does not do that.
Once you have granted geolocation permission, you can use those permissions with other plugins, if you haven't granted permissions before calling map.getMyLocation(), you should be prompted to grant permissions when calling that function on Android 6+.
@ZiFFeL1992 That is already accepted issue https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/892
Is possible config Location permission plugin ONLY for When Is Usage? Now, after each build, I have to delete the NSLocationAlwaysUsage in XCode directly.
Could you help us?