使用GPS提示的问题是Call requires permission which may be rejected by user: code should explicitly check to s
来源:互联网 发布:彩虹6号优化补丁 编辑:程序博客网 时间:2024/06/16 14:02
1.在使用GPS的时候提示Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with `checkPermission`) or explicitly handle a potential `SecurityException`more... (Ctrl+F1),这句话的意思是:调用需要的权限可能被用户拒绝,代码应该显示地检查权限是否可用,用checkpermission或者显示地处理一个潜在的SecurityException异常,这时候其实已经说明你的api使用的是23以上了,
2.我的解决办法是添加判断,代码如下:
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)
{}
阅读全文
1 0
- 使用GPS提示的问题是Call requires permission which may be rejected by user: code should explicitly check to s
- Call requires permission which may be rejected by user: code should explicitly check to see if permi
- call requires permission which may be rejected by user;code should explicitly check to see if permis
- Call requires permission which may be rejected by user: code should explicitly check to see if permi
- Android 23使用定位权限报错Call requires permission which may be rejected by user
- Caused by: java.lang.RuntimeException: A TaskDescription's primary color should be opaque的解决方案
- iOS This iPhone 6s等 is running iOS 10.1 (14B72), which may not be supported by this version of Xcode
- 易读代码的艺术之Code Should Be Easy to Understand
- 编译报错“a pointer to a bound function may only be used to call the function”的解决办法
- 警告The argument of type String[] should explicitly be cast to Object[] for the invocation of the vara
- findbugs提示:May expose internal representation by incorporating reference to mutable object 的理解.
- Which tool should be used to find out a "jmp esp"
- a pointer to a bound function may only be used to call the function
- a pointer to a bound function may only be used to call the function
- 使用RMAN命令时提示“ RECOVERY_CATALOG_OWNER role must be granted to user RCAT”
- asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_
- This iPhone 6 is running iOS 10.2 (14C92), which may not be supported by this version of Xcode.
- This iPhone 6 is running iOS 10.1 (14B55c), which may not be supported by this version of Xcode
- (lintcode)第17题 子集
- mybatis动态sql中的trim标签的使用
- 免安装版MySQL(1)能够正常使用解决方案总结
- 图像识别学习笔记
- [日推荐]『微商名片王』做个有逼格的微商
- 使用GPS提示的问题是Call requires permission which may be rejected by user: code should explicitly check to s
- Gensim使用小解
- 《Spring3实战》摘要(5-2)Spring中使用Hibernate
- Redis 的 Sentinel 文档
- theharvester
- springMVC接收json格式
- 哈夫曼编码链表+树实现
- Hibernate框架中的缓存技术详解
- HDOJ HDU 1015 Safecracker