android GPS: code should explicitly check to see if permission is available

转载的,感谢作者,由于我找了很久才找到这个解决方法,因此我自己再转一遍

原文链接

https://blog.csdn.net/qinwendou/article/details/77849048

 

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)
{}
---------------------

posted @ 2019-07-09 19:23  地表最强队队员  阅读(565)  评论(0编辑  收藏  举报