在获取位置的时候首先要判断gps是否打开,如果没有打开就要提示打开,当然最友好的就是直接调转到打开界面。

LocationManager alm = (LocationManager)this.GetSystemService(Context.LocationService);
if (alm.IsProviderEnabled(Android.Locations.LocationManager.GpsProvider) == false) //判断GPS是否是打开状态
{
Toast.MakeText(this, "PLS Open GPS!!!", ToastLength.Short).Show();
Intent intent = new Android.Content.Intent(Settings.ActionLocationSourceSettings);

StartActivityForResult(intent,0);//此为设置完成后返回到获取界面

}

 

相关文章:

  • 2021-12-26
  • 2021-11-17
  • 2021-06-03
  • 2021-11-15
  • 2021-06-10
  • 2022-12-23
  • 2021-11-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案