if (ActivityCompat.checkSelfPermission(this@TaskActivity, Manifest.permission_group.LOCATION) != PackageManager.PERMISSION_GRANTED) {
возвращает true if (ActivityCompat.checkSelfPermission(this@TaskActivity, Manifest.permission_group.LOCATION) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(this@TaskActivity, arrayOf("Manifest.permission.ACCESS_FINE_LOCATION",
"Manifest.permission.ACCESS_COARSE_LOCATION"), 200)
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == 200) {
printLogs(grantResults[0].toString())
printLogs(PackageManager.PERMISSION_GRANTED.toString())
printLogs(PackageManager.PERMISSION_DENIED.toString())
if (grantResults.size > 0 &&
grantResults[0] == PackageManager.PERMISSION_GRANTED) {
locationManager = getSystemService(Context.LOCATION_SERVICE) as LocationManager
}
}
}
gps location provider requires access_fine_location permission. Много чего перепробовал, не получается устранить. Я читал что на sdk выше 23 нужно указывать разрешения runtime. Но опять-таки не выходит(