Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
On the newly released version (0.5) when I want to use location for the first time I do not get a message asking if the app can use the location services on iPhone. Therefore the IsGeolocationEnabled is always false.
The current design really doesn't handle this very well, so I'm looking into adjusting it to make more sense. For the moment, you can also simply call GetPositionAsync or StartListening, which will trigger the permission request. You'll get a GeolocationException or the PositionError event will fire (respectively) should permission be (or still be) denied.
After further review, we feel that this is the correct behavior. We'll be updating the docs to clarify things better, but in the mean time I'll explain.
IsGeolocationEnabled is meant to represent that you can start listening for location right now and it'll work. If the user hasn't been asked yet, that isn't true, therefore it is false.
There are two primary category of apps, those that require location (like a running app) and those that don't (a photo app, giving you the option to geotag photos). For the former, you will always need location, so you can simply start listening and you'll get the same error you expect.
For apps that have optional support, we suggest keeping track of whether you've prompted the user for locations already:
if (!alreadyAsked || geolocator.IsGeolocationEnabled)
alreadyAsked = true; // Persist this
This will allow you to prompt the user only once (as per Apple's guidelines) and will Just Work if they've already said yes (or are on Android or Windows Phone), and won't do anything if they've disabled geolocation completely or for the app.