Created
September 7, 2020 06:07
-
-
Save fredchung/f46ca3b64e0b3a02806cbb6790275583 to your computer and use it in GitHub Desktop.
Do not request foreground and background location permissions together (Activity library).
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
// Using Activity library. | |
val requestPermissionsLauncher = | |
registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { | |
map: MutableMap<String, Boolean> -> | |
... | |
} | |
... | |
requestPermissionsLauncher.launch( | |
arrayOf( | |
// Do not request foreground and background location permissions together, | |
// as they will be ignored along with any other permissions in the request. | |
// Request location permissions incrementally instead. | |
android.Manifest.permission.ACCESS_COARSE_LOCATION, | |
android.Manifest.permission.ACCESS_BACKGROUND_LOCATION, | |
...) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment