Skip to content

Instantly share code, notes, and snippets.

View Hamadakram's full-sized avatar

Hammad Akram Hamadakram

View GitHub Profile
@Hamadakram
Hamadakram / LocationServiceCheck
Last active May 15, 2019 07:43
Check if location service is enabled
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()