当前位置: 首页 > java > 正文

使用GPS提示的问题是Call requires permission which may be rejected by user: code should explicitly check to s

admin 发表于2022年9月21日 14:11
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){
lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

}

lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

这句话放在这个if语句就可以

全文完
本文标签: android
本文标题: 使用GPS提示的问题是Call requires permission which may be rejected by user: code should explicitly check to s
本文链接: http://blog.qqzzz.net/m/?post=153

〓 随机文章推荐

共有766阅 / 0我要评论
  1. 还没有评论呢,快抢沙发~

发表你的评论吧返回顶部

!评论内容需包含中文

请勾选本项再提交评论