Android (Xamarin Forms): GeoLocation Loops on Prompt denial

I am using the GeoLocation plugin. I have code on the HomePage which is calling the plugin (OnAppearing) to get locations closets to the user's phone. On the initial use, if the user clicks on DENY, it continues to Loop and send the prompt back to the screen again. THere has to be a way to avoid prompting the user multiple times if they deny Location services...It seems like the OnAppearing event is triggered on the denial each time. It's probably a matter of my not knowing how to approach that so thank you to anyone who can help. Below is the code in the portable app and the MainActivity in the Driod project:.

   protected override void** OnAppearing()**
    {
            location = await geolocationviewmodel.GetCurrentLocation();

            if (!location.isEnabled)
            {
                // display message
            }
            else if (!location.isAvailable)
            {
                Device.BeginInvokeOnMainThread(() =>
                {
            // display different message                
               });
            }
            else
            {
        displays location info

                }


**MAIN ACTIVITY.cs**
    public override async void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
    {
        PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);

    }
Sign In or Register to comment.