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
// Request permission | |
ActivityCompat.requestPermissions( | |
this@MainActivity, | |
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), | |
REQUEST_FOREGROUND_ONLY_PERMISSIONS_REQUEST_CODE | |
) |
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
<!-- Specify the permissions that you are using --> | |
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> | |
<!-- Specify the background location permission. --> | |
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> | |
<!-- Declare a foreground service, if applicable --> | |
<service | |
android:name="MyForgroundService" | |
android:foregroundServiceType="location"> |
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
// Request background permission | |
ActivityCompat.requestPermissions( | |
this@MainActivity, | |
arrayOf(Manifest.permission.ACCESS_BACKGROUND_LOCATION), | |
REQUEST_BACKGROUND_ONLY_PERMISSIONS_REQUEST_CODE | |
) |
OlderNewer