Closed ferrydeboer closed 8 years ago
Hmmm, this is a tricky one as to find this out you need to have it be a Task
Providers will also have a problem if permission isn't requested....
Need to think about this and how we can change the API.
I use both booleans in conjunction. What about an extra function Task<bool> AssureGpsAvailable()
. This first checks/requests permissions and only then queries the booleans. That way the existing API doesn't need to be changed.
You can query the booleans if you want to inform the user more specifically in case the Assure function returns false. If both booleans are then true it's sort of safe to assume the AssureGpsAvailable
returned false because of the permissions. Or you can return an enum from AssureGpsAvailable
instead of a boolean.
until I have a fix checkout using the permissions plugin for this :)
This issue was moved to jamesmontemagno/GeolocatorPlugin#4
Please take a moment to fill out the following (change to preview to check or place x in []):
This is a
Which plugin does this impact:
Version Number of Plugin: 3.0.4 Device Tested On: Sony Xperia Z3 Compact Simulator Tested On: -
Expected Behavior
Plugin will request permission when IsGeolocationAvailable or IsGeolocationEnabled is queried but there are no granted permissions yet.
Actual Behavior
We query both properties prior to doing a location request thus preventing a possible exception. But since these properties return false when no permissions have been granted yet our code never reaches the GetPositionAsync where the actual permission is requested.
Steps to reproduce the Behavior
Change lines 29 and 30 of
GeolocatorTests.GeolocatorTests.cs
to