locked
[UWP] Geolocator RequestAccess PopUp not showing RRS feed

  • Question

  • Hi,

    I am developing Windows 10 UWP app, in that I am using location services.

    First I am calling the below method to know the status of the location service.

    var status= awaitGeolocator.RequestAccessAsync();

    This method launch a popup prompting user to allow the location access. Here if I selects No after that onwards the status of the location always denied. Due to this the app is not able to work as expected.

    The Allow Location access popup only showing for the first time of the app launching. Now there is no way to re-enable the access permission for my app.

    How can I give an option to re-enable the location permission for my app?

    Wednesday, September 23, 2015 12:02 PM

Answers

  • Hi Narendra Macha,

    >>Now there is no way to re-enable the access permission for my app.

    We have to reminder the user change location permissions by redirecting to the location settings on their device:

    var status = await Geolocator.RequestAccessAsync();
    
    if (status == GeolocationAccessStatus.Denied)
    {
                    //Show some messages to let OP open the location accessing permission
                    var uri = new Uri("ms-settings:privacy-location");
                    // Launch the URI
                    var success = await Windows.System.Launcher.LaunchUriAsync(uri);
    
    }
    

    See also document: https://msdn.microsoft.com/library/windows/apps/windows.devices.geolocation.geolocator.requestaccessasync.aspx

    The RequestAccessAsync method prompts the user for permission to access their location. The user is only prompted once (per app). After the first time they grant or deny permission, this method no longer prompts for permission. To help the user change location permissions after they've been prompted, we recommend providing a link to the location settings on their device.

    Tip  To link to location settings from your app, call the LaunchUriAsync method with the URI "ms-settings:privacy-location". For more info, see Launch the Windows Settings app.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, September 24, 2015 6:09 AM