I am using Fused Location Provider API to get device location in my project. When the location services are off it shows an alert dialog asking the user to turn it on.
Is there any way to customize this alert dialog to show a different message?
Code:
LocationServices.getSettingsClient(this)
.checkLocationSettings(locationRequestBuilder.build())
.addOnCompleteListener {
try {
it.getResult(ApiException::class.java)
// Location settings are On
} catch (exception: ApiException) { // Location settings are Off
when (exception.statusCode) {
RESOLUTION_REQUIRED -> try { // Check result in onActivityResult
val resolvable = exception as ResolvableApiException
resolvable.startResolutionForResult(this, LOCATION_REQUEST_CODE)
} catch (ignored: IntentSender.SendIntentException) {
} catch (ignored: ClassCastException) {
}
// Location settings are not available on device
}
}
}
