Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Xamarin on Android API 29: Get background location always #245

Open
JamesDepret opened this issue Mar 14, 2021 · 0 comments
Open

Xamarin on Android API 29: Get background location always #245

JamesDepret opened this issue Mar 14, 2021 · 0 comments

Comments

@JamesDepret
Copy link

JamesDepret commented Mar 14, 2021

Xamarin.Android Version (eg: 6.0):
Version API 29

Operating System & Version (eg: Mac OSX 10.11):
Samsung SM-A515F android 10.0 - API 29
Xamarin.AndroidX

Support Libraries Version (eg: 23.3.0):
28.0.0.3

Describe your Issue:
I'm asking the background location in my app, which is targeting API version 29, however, when I get asked for the permissions, I only see the option "Only while the app is active" and "decline", I am missing the option: "Always On"

For my app, I need "App requests permission always (foreground and background)"
I found the same question here: https://forums.xamarin.com/discussion/181976/location-foreground-service

But the answer doesn't work for me.
I have the android 10.0 SDK installed, in properties of my project I am targeting version 10.0 (Q) as the compile version

In my manifest I have

    <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="29" />

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

As for my permission request I'm using Essentials:

        public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Android.Content.PM.Permission[] grantResults)
        {
            Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
            base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
        }

According to this post: https://stackoverflow.com/questions/65071993/background-location-not-working-when-app-in-background-xamarin-forms-android-app, we need to wait for an updated version, but I see there hasn't been a release since 9 Oct 2019. Is this answer correct, and if so, is there any nearby release planned?

Steps to Reproduce (with link to sample solution if possible):
Target API level 29 and ask for location permissions, the option "Always on" is not available to us

Include any relevant Exception Stack traces, build logs, adb logs:

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

No branches or pull requests

1 participant