Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requesting ACCESS_BACKGROUND_LOCATION never completes #28

Open
yozhiqueAtMTS opened this issue Sep 20, 2023 · 4 comments
Open

Requesting ACCESS_BACKGROUND_LOCATION never completes #28

yozhiqueAtMTS opened this issue Sep 20, 2023 · 4 comments

Comments

@yozhiqueAtMTS
Copy link

yozhiqueAtMTS commented Sep 20, 2023

Hello there! Trying to gain background access. I learned that Peko, while requesting ACCESS_BACKGROUND_LOCATION, transitions user to the app permission settings only if ACCESS_FINE_LOCATION was previously gained, otherwise the flow does not emit anything. Is it intended behavior?

Steps to reproduce:

AndroidManifest:

  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

Activity's onCreate():

PermissionRequester.apply {
    initialize(applicationContext)
    lifecycleScope.launch {
        repeatOnLifecycle(STARTED) {
            try {
                instance().request(
                    permission.ACCESS_BACKGROUND_LOCATION,
                )
                    .catch {
                        Log.d("DEBUG_PERMISSIONS", "catch: $it")
                    }
                    .collect {
                        Log.d("DEBUG_PERMISSIONS", "$it")
                    }
            } catch (e: Throwable) {
                Log.d("DEBUG_PERMISSIONS", "error: $e")
            }
        }
    }
}
@deva666
Copy link
Owner

deva666 commented Sep 21, 2023

Thanks for reporting this, I am looking into it.

@deva666
Copy link
Owner

deva666 commented Sep 25, 2023

I just tried it on Android 12 and I got the result Needs Rationale. This is for the clean app install, no prior permissions are given.

@codeslu
Copy link

codeslu commented Mar 30, 2024

This happens with me as well , Requesting multiple permissions with requesting background location access results in Needs Rationale and Denies the rest of the permissions automatically without showing any kind of dialog
[2024-03-30 02:51:12] Needs Rationale: ACCESS_BACKGROUND_LOCATION
[2024-03-30 02:51:12] Denied Permanently: ACCESS_FINE_LOCATION
[2024-03-30 02:51:12] Denied Permanently: ACCESS_COARSE_LOCATION
[2024-03-30 02:51:12] Denied Permanently: POST_NOTIFICATIONS

@deva666
Copy link
Owner

deva666 commented Apr 3, 2024

I just tried to request all three location permissions at the same time and got the same result as you.
But reading the official docs https://developer.android.com/develop/sensors-and-location/location/permissions and their examples of requesting location, they request only ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION in the same permission request
Also they say

Types of location access

Each permission has a combination of the following characteristics:

Category: Either [foreground location](https://developer.android.com/develop/sensors-and-location/location/permissions#foreground) or [background location](https://developer.android.com/develop/sensors-and-location/location/permissions#background).
[Accuracy](https://developer.android.com/develop/sensors-and-location/location/permissions#accuracy): Either precise location or approximate location.

When I try to request ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION with Peko I get the Request popup and the result is not Denied Permanently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants