Manifest.permission.ACCESS_COARSE_LOCATION的权限被拒绝

时间:2018-12-04 07:52:33

标签: android google-maps

我正在尝试将 Google Maps API 与Android集成。

当我尝试获得

的权限时

Manifest.permission.ACCESS_FINE_LOCATIONManifest.permission.ACCESS_COARSE_LOCATIONManifest.permission.ACCESS_COARSE_LOCATION的权限被拒绝。但是,授予Manifest.permission.ACCESS_FINE_LOCATION的权限。我想知道Manifest.permission.ACCESS_COARSE_LOCATION被拒绝的原因。任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:0)


创造这个乐趣 (Kotlin)

 fun setupPermissions(context:Context,activity: Activity,permission: String, requestCode: Int) {
    if (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_DENIED) {
        // Requesting the permission
        ActivityCompat.requestPermissions(activity, arrayOf(permission), requestCode)
        return
    }
}

之后调用

setupPermissions(requireContext(),requireActivity(),*CAMERA*,234)