This file contains hidden or 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
| setForeground( | |
| ForegroundInfo(NOTIF_ID, | |
| notification.build(), | |
| // Foreground service types. | |
| ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION or ...) | |
| ) |
This file contains hidden or 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
| <service | |
| android:name="androidx.work.impl.foreground.SystemForegroundService" | |
| android:foregroundServiceType="location|microphone" | |
| tools:node="merge" /> |
This file contains hidden or 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
| android:foregroundServiceType = "microphone | location | camera" |
This file contains hidden or 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( |
This file contains hidden or 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
| requestPermissions( | |
| 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, | |
| ...) | |
| ) |