Fix background location permission for Android > 10.

This commit is contained in:
Onuray Sahin 2022-03-17 12:29:46 +03:00
parent 575d62a354
commit 33e5a206bd
2 changed files with 7 additions and 7 deletions

View File

@ -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()
}
}

View File

@ -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 youd 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 youd 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>