android 检查GPS是否开启,GPS设置界面
16lz
2021-01-23
GPS是否开启LocationManager locationManager = (LocationManager)getContext().getSystemService(Context.LOCATION_SERVICE);return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);进入GPS设置页面 Intent intent = new Intent(); intent.setAction(Settings.ACTION_LOCATION_SOURCE_SETTINGS); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try { getContext().startActivity(intent); } catch(ActivityNotFoundException ex) { // The Android SDK doc says that the location settings activity // may not be found. In that case show the general settings. // General settings activity intent.setAction(Settings.ACTION_SETTINGS); try { getContext().startActivity(intent); } catch (Exception e) { } }
更多相关文章
- Android WebView 页面自适应
- Android 开发之webview页面返回到最顶关闭
- android 页面切换动画效果 转
- android > intent > 自动跳转到 系统 设置 页面
- Android之TabLayout+ViewPager+Fragment实现标题栏与页面联动
- Android实现页面悬浮显示
- React Native Linking与 Android原生页面路由跳转问题
- 如何在android中实现swipe的手势功能及页面拖动动画
- Android 使用WebView加载含有echarts的页面,截图不显示的解决方式