Last active
April 22, 2022 09:51
-
-
Save FireZenk/af56a09da26899fa5d22401a3f453031 to your computer and use it in GitHub Desktop.
Open Location services activation settings from Compose
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
@Composable | |
fun ActivateLocationServices() { | |
val context = LocalContext.current | |
val lm = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager | |
if (!LocationManagerCompat.isLocationEnabled(lm)) | |
context.startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)) | |
} |
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
// Composable | |
ActivateLocationServices() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment