Skip to content

Instantly share code, notes, and snippets.

@Lavanyagaur22
Created April 26, 2020 12:24
Show Gist options
  • Save Lavanyagaur22/b91982554400526febc95b9388445149 to your computer and use it in GitHub Desktop.
Save Lavanyagaur22/b91982554400526febc95b9388445149 to your computer and use it in GitHub Desktop.
// Sets the desired interval for active location updates. This interval is inexact. You
// may not receive updates at all if no location sources are available, or you may
// receive them less frequently than requested. You may also receive updates more
// frequently than requested if other applications are requesting location at a more
// frequent interval.
locationRequest = LocationRequest().apply {
// Sets the desired interval for active location updates.
interval = TimeUnit.SECONDS.toMillis(60)
// Sets the fastest rate for active location updates.
fastestInterval = TimeUnit.SECONDS.toMillis(30)
// Sets the maximum time when batched location updates are delivered. Updates may be
// delivered sooner than this interval.
maxWaitTime = TimeUnit.MINUTES.toMillis(2)
priority = LocationRequest.PRIORITY_HIGH_ACCURACY
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment