Skip to content

Instantly share code, notes, and snippets.

@saurabharora90
Last active July 10, 2019 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saurabharora90/a7f6606e5d2e5318115c2c7dd284a690 to your computer and use it in GitHub Desktop.
Save saurabharora90/a7f6606e5d2e5318115c2c7dd284a690 to your computer and use it in GitHub Desktop.
Request access to location while app is in background,
<manifest>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
</manifest>
//Request for the permission like any other permission request:
ActivityCompat.requestPermissions(this,
arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION),
your-permission-request-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment