如何检查Windows Phone 8中是启用还是禁用位置服务?
答案 0 :(得分:2)
public bool IsLocationServiceEnabled
{
get
{
Geolocator locationservice = new Geolocator();
if (locationservice.LocationStatus == PositionStatus.Disabled)
{
return false;
}
return true;
}
}
答案 1 :(得分:2)
using Windows.Devices.Geolocation;
Geolocator locator = new Geolocator();
if (locator.LocationStatus == PositionStatus.Disabled)
{
// Location is turned off
}
此外,PositionStatus
枚举还有几个值,如:
Ready, NoData, Initializing, Disabled, NotInitialized, NotAvailable.
希望这会对你有所帮助。 谢谢和欢呼。