Skip to content

Instantly share code, notes, and snippets.

Hammad Akram Hamadakram

View GitHub Profile
@Hamadakram
Hamadakram / LocationServiceCheck
Last active May 15, 2019
Check if location service is enabled
View LocationServiceCheck
private fun checkLocationServices(context: Context) {
val googleApiClient = GoogleApiClient.Builder(context)
.addApi(LocationServices.API).build()
googleApiClient.connect()
val locationRequest = LocationRequest.create()
locationRequest.priority = LocationRequest.PRIORITY_HIGH_ACCURACY
locationRequest.interval = 10000
locationRequest.fastestInterval = (10000 / 2).toLong()
You can’t perform that action at this time.