您好,我有一个代码来创建类似Google Map对话框的对话框,
但我读到LocationServices.SettingsApi
是deprecated。有没有办法更改SettingApi
以获得类似于Google Maps的对话框?
mLocationRequest = LocationRequest.create()?.apply {
interval = 10000
fastestInterval = 5000
priority = LocationRequest.PRIORITY_HIGH_ACCURACY
}!!
val builder = LocationSettingsRequest.Builder()
.addLocationRequest(mLocationRequest)
builder.setAlwaysShow(true)
val task = LocationServices.SettingsApi.checkLocationSettings(mGoogleApiClient, builder.build())
task.setResultCallback { result ->
val status = result.status
when (status.statusCode) {
LocationSettingsStatusCodes.RESOLUTION_REQUIRED -> try {
status.startResolutionForResult(mActivity, REQUEST_LOCATION)
} catch (e: IntentSender.SendIntentException) {
}
}
}