开启GPS
16lz
2021-01-26
/** * 打开GPS */ public static void openGPSSettings(Context context) { LocationManager locationManager = (LocationManager) context .getSystemService(Context.LOCATION_SERVICE); if (locationManager.isProviderEnabled(android.location.LocationManager.GPS_PROVIDER)) { Log.d(TAG, "已開啟GPS"); return; } else { Intent intent = new Intent(Settings.ACTION_SECURITY_SETTINGS); showToast(context, "請開啟GPS"); context.startActivity(intent); } }
更多相关文章
- Android开发-打开另一个Activity或打开网页
- Android打开/关闭免提(SpeakerPhone)
- 整理了下viewpagerTransformers框架的效果图
- android sensors 总结(四)
- Android(安卓)4.1打开相机(自己写的压力测试APK)
- 关于Android(安卓)emulator的proxy问题
- android打开文件、保存对话框、创建新文件夹对话框
- Cordova项目使用Android(安卓)Studio真机调试
- android中打开相机、打开相册进行图片的获取示例