获取GPS功能是否禁用:
mgr=(LocationManager)getSystemService(LOCATION_SERVICE);
if(mgr.isProviderEnabled((android.location.LocationManager.GPS_PROVIDER )))Toast.makeText(TestActivity.this,"gps enable", Toast.LENGTH_SHORT).show();
else Toast.makeText(TestActivity.this,"gps dis", Toast.LENGTH_SHORT).show();
本文提供了一段用于检测Android设备上GPS功能是否启用的代码示例。通过使用LocationManager类的isProviderEnabled方法,可以轻松判断GPS是否处于开启状态。
2553

被折叠的 条评论
为什么被折叠?



