I'm able to check if user has enabled GPS location via calback
LocationManagerCompat.registerGnssStatusCallback.
Problem is that it needs ACCESS_FINE_LOCATION permission but I'd like to use is also when user enables only ACCESS_COARSE_LOCATION. Is there any clean solution how to achieve it.
Right now, I repeatedly check locationSettings which is not optimal.
locationStatusTimer = Timer().schedule(0, LOCATION_STATUS_REQUEST_PERIOD) {
LocationServices.getSettingsClient(activity)
.checkLocationSettings(
LocationSettingsRequest.Builder()
.addLocationRequest(locationRequest)
.build()
).addOnSuccessListener {
deviceLocationController.updateLocationStatus(DeviceLocationStatus.Enabled)
}.addOnFailureListener {
deviceLocationController.updateLocationStatus(DeviceLocationStatus.Disabled)
}
}