Fix background location permission for Android > 10.
This commit is contained in:
parent
575d62a354
commit
33e5a206bd
@ -209,14 +209,14 @@ class LocationSharingFragment @Inject constructor(
|
||||
}
|
||||
|
||||
private fun tryStartLiveLocationSharing() {
|
||||
// TODO handle Android 11+ case => cannot ask runtime permission for background location
|
||||
// when ActivityCompat.shouldShowRequestPermissionRationale() returns true
|
||||
// show dialog to redirect to app settings (handleMissingBackgroundLocationPermission())
|
||||
|
||||
// TODO test with Android 6, Android 10 and Android 11
|
||||
// we need to re-check foreground location to be sure it has not changed after landing on this screen
|
||||
if (checkPermissions(PERMISSIONS_FOR_FOREGROUND_LOCATION_SHARING, requireActivity(), foregroundLocationResultLauncher) &&
|
||||
checkPermissions(PERMISSIONS_FOR_BACKGROUND_LOCATION_SHARING, requireActivity(), backgroundLocationResultLauncher)) {
|
||||
checkPermissions(
|
||||
PERMISSIONS_FOR_BACKGROUND_LOCATION_SHARING,
|
||||
requireActivity(),
|
||||
backgroundLocationResultLauncher,
|
||||
R.string.location_in_background_missing_permission_dialog_content
|
||||
)) {
|
||||
startLiveLocationSharing()
|
||||
}
|
||||
}
|
||||
|
@ -2938,7 +2938,7 @@
|
||||
<string name="location_share_option_pinned">Share this location</string>
|
||||
<string name="a11y_location_share_option_pinned_icon">Share this location</string>
|
||||
<string name="location_in_background_missing_permission_dialog_title">Allow access</string>
|
||||
<string name="location_in_background_missing_permission_dialog_content">If you’d like to share your Live location, ${app_name} needs location access when the app is in the background.\nWe will only access your location for the duration that you choose.</string>
|
||||
<string name="location_in_background_missing_permission_dialog_content">If you’d like to share your Live location, ${app_name} needs location access all the time when the app is in the background.\nWe will only access your location for the duration that you choose.</string>
|
||||
<string name="location_not_available_dialog_title">${app_name} could not access your location</string>
|
||||
<string name="location_not_available_dialog_content">${app_name} could not access your location. Please try again later.</string>
|
||||
<string name="location_share_external">Open with</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user