Closed programmingworld1 closed 4 years ago
you are crazy wanting a location plugin to do permissions for many reasons, most notable being a very poor user experience as you are not controlling when the user gets interrupted to give permission. I would recommend implementing a proper UI flow and use this plugin to request permissions and only start the part of the app that uses location once granted.
https://docs.microsoft.com/en-us/xamarin/essentials/permissions?tabs=ios
@chrisfoulds But I reed this in the documentation of geolocator plugin "Before making any calls to the geolocator that requires the permissions, you should consider checking that the user has granted proper permission. The geolocator plugin will attempt to ask for permission, but it is not guaranteed."
So it should handle it for me right? If not, I can indeed use the link you just gave me, but what happens if the user is asked permission twice (once by my code using the link you send and once by geolocator).
hope you can help me out!
As it says not guaranteed, as in might not happen.
Why in the world would they be asked twice? Do you know how permissions work ? Once the user has granted them it is for the entire app.
@chrisfoulds you are right, thank you.
@chrisfoulds Do you perhaps know why the the permissions packge (in xamarin essentials) always grants me Granted while it shouldn't, just curious because you seem to know a lot about this library.
@programmingworld1 no sorry, both libraries used in conjunction work perfectly for me straight away. It is probably best you raise a issue on xamarin essentials with as much detail as possible. Android/iOS etc. etc. but there dozens of threads of similar issues just a google away with solutions https://forums.xamarin.com/discussion/179666/xamarin-essentials-permissions-failing-to-grant-permission
@chrisfoulds Now I get the permission granted, but the isGeolocationEnabled is always false... I make use of the latest xamarin essentials, geolocator plugin and make use of the xamarin essentials permissions instead of the jamesmontemagno permission library. Is it a problem doing that?
Bug Information
When using "CrossGeolocator.Current.StartListeningAsync" or "locator.GetPositionAsync" I exptect the library to ask the user for permission if the user has not given the permission yet.
Version Number of Plugin:4.5.0.6 Device Tested On: Simulator Tested On: Iphone 11 IOS 13.4 and Android A70 Version of VS: Visual Studio 2019 16.5.4 Version of Xamarin: latest Versions of other things you are using:
Steps to reproduce the Behavior
Ask for location or use the Listen StartListeningAsync method
Expected Behavior
When there is no location permission, a popup should be displayed asking the user for location permission
Actual Behavior
It doesn't show the popup to ask the user for location permission
Code snippet
` if (!_crossGeolocatorService.IsGeolocationAvailable()) { _userDialogs.Alert("Geolocation is not available on this device!"); return; }