我正在尝试将 Google Maps API 与Android集成。
当我尝试获得
的权限时 Manifest.permission.ACCESS_FINE_LOCATION
和Manifest.permission.ACCESS_COARSE_LOCATION
,Manifest.permission.ACCESS_COARSE_LOCATION
的权限被拒绝。但是,授予Manifest.permission.ACCESS_FINE_LOCATION
的权限。我想知道Manifest.permission.ACCESS_COARSE_LOCATION
被拒绝的原因。任何帮助表示赞赏。
答案 0 :(得分:0)
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)