Xamarin Recursive Location Request

▼魔方 西西 提交于 2019-12-08 09:50:19

问题


I'm working in a ios recursive function to send the message 'My App need request your location' each time that the user turn off his GPS then, the message should appears again requesting his location.

I'm just using:

public bool LocationServicesEnabled {
    get {return CLLocationManager.LocationServicesEnabled;}
}
public bool IsAuthorized {
    get {return CLAuthorizationStatus.Authorized == _authstatusLast;}
}

With those functions, the first one return me is the Service is Enable and the second one if the user autorizate it.

Just now, I can do something similar to:

if(_locationServiceEnalbed && IsAuthorized){
            Manager = new LocationManager();
            Manager.StartLocationUpdates();
    }

But is not requesting me my location again. How I can display the message again requesting the user location?


回答1:


According to Apple, if they deny access to your app, you can request it again by trying to start the location services

If it returns NO and you attempt to start location services anyway, the system prompts the user to confirm whether location services should be re-enabled. Because the user probably disabled location services on purpose, the prompt is likely to be unwelcome.

However, a more friendly approach might be to display a message that this feature of your app is disabled until they grant permissions to use GPS, and to direct them to the Settings menu where it can be re-enabled



来源:https://stackoverflow.com/questions/26723129/xamarin-recursive-location-request

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!