Created
July 2, 2018 08:08
-
-
Save ngima/a882f85858b90c6a20578fde993225d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun displayLocationSettingsRequest(context: Context) { | |
var googleApiClient = GoogleApiClient.Builder(context) | |
.addApi(LocationServices.API).build(); | |
googleApiClient.connect(); | |
var locationRequest = LocationRequest.create(); | |
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); | |
locationRequest.setInterval(30 * 1000); | |
locationRequest.setFastestInterval(5 * 1000); | |
var builder = LocationSettingsRequest.Builder() | |
.addLocationRequest(locationRequest); | |
builder.setAlwaysShow(true); | |
var result = LocationServices.getSettingsClient(context).checkLocationSettings(builder.build()); | |
result.addOnCompleteListener { | |
when(it.isSuccessful){ | |
true->{} | |
false->{} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment