没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
/**
* 三种方法检测GPS方式是否开启
*/
public boolean checkProvider() {
/**
* 方法一:
* 反射法
*/
// try {
// Class<?> secureClass = Class.forName("android.provider.Settings$Secure");
// Method isLocationProviderEnabledMethod = secureClass.getMethod("isLocationProviderEnabled", ContentResolver.class, String.class);
// if(!(Boolean) isLocationProviderEnabledMethod.invoke(secureClass, context.getContentResolver(), LocationManager.GPS_PROVIDER)){
// System.out.println("GPS is shutdown!!!");
// }
// else{
// System.out.println("GPS is OK!!!");
// }
// if(!(Boolean) isLocationProviderEnabledMethod.invoke(secureClass, context.getContentResolver(), LocationManager.NETWORK_PROVIDER)){
// System.out.println("NETWORK_PROVIDER is shutdown!!!");
// }
// else{
// System.out.println("NETWORK_PROVIDER is OK!!!");
// }
// } catch (Exception e) {
// Log.d(TAG, "checkProvider failed...\n" + e.toString());
// }
/**
* 方法二:
资源评论
- YYboboYY2014-06-09嗯,不错,有参考价值
冯保佳
- 粉丝: 1
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功