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

Allow only while using the app in android 10 returns GeolocationStatus.denied #334

Closed
humazed opened this issue Oct 3, 2019 · 37 comments
Closed
Labels
platform: android Issue is related to the Android platform. status: in progress Indicates that this issue is currently being worked on.

Comments

@humazed
Copy link

humazed commented Oct 3, 2019

🐛 Bug Report

when selecting Allow only while using the app the new option in Android 10 Geolocator().checkGeolocationPermissionStatus() returns GeolocationStatus.denied
Screenshot_1570103723

Version: 5.1.4

Platform:
🤖 Android

@StijnWoerkom StijnWoerkom added platform: android Issue is related to the Android platform. type: bug Something isn't working labels Oct 3, 2019
@StijnWoerkom
Copy link
Contributor

Could you tell me more about the code that returns GeolocationStatus.denied?

@humazed
Copy link
Author

humazed commented Oct 3, 2019

I can reproduce it with the sample app.
just try it with an android 10 emulator.

@StijnWoerkom
Copy link
Contributor

Does the emulator solve the GeolocationStatus.denied error?

@humazed
Copy link
Author

humazed commented Oct 5, 2019

I'm not sure I understand what you mean

@StijnWoerkom
Copy link
Contributor

Could you tell me some details about the code and what you are trying to create? I am trying to reproduce your issue, but I need more information.

@StijnWoerkom StijnWoerkom added the status: needs more info We need more information before we can continue work on this issue. label Oct 7, 2019
@humazed
Copy link
Author

humazed commented Oct 7, 2019

try the demo app on an android emulator with android 10
untitled

@StijnWoerkom StijnWoerkom removed the status: needs more info We need more information before we can continue work on this issue. label Oct 7, 2019
@StijnWoerkom
Copy link
Contributor

I reproduced this issue and came to the conclusion that the location settings from the device were turned off. To fix this issue go to Settings>Location>Use Location>On.

@StijnWoerkom StijnWoerkom added good first issue Good for newcomers who would like to start contributing to the project. and removed type: bug Something isn't working labels Oct 8, 2019
@humazed
Copy link
Author

humazed commented Oct 8, 2019

the location was turned on I checked it, hence when I choose allow all the time it recognized as granted.

untitled

@StijnWoerkom
Copy link
Contributor

The output of the app says you are using FusedLocationProvider. It's recommended to use Google Play services version 11.6.0 or higher, which includes bug fixes for this class.

@StijnWoerkom StijnWoerkom self-assigned this Oct 8, 2019
@humazed
Copy link
Author

humazed commented Oct 8, 2019

https://imgur.com/a/egX6z6t

As you can see I'm using google play services 19.2.75 and the location is on

@gkrawiec
Copy link

gkrawiec commented Oct 8, 2019

Its a completely new permission in the new Android 10. it should neither give Allowed or Denied since it requires different checks.

https://developer.android.com/reference/android/Manifest.permission.html#ACCESS_BACKGROUND_LOCATION

@StijnWoerkom
Copy link
Contributor

@humazed What are you trying to achieve with the Geolocator().checkGeolocationPermissionStatus() method? I don't get any errors if I set the location settings to Allowed all the time.

@StijnWoerkom StijnWoerkom added status: in progress Indicates that this issue is currently being worked on. and removed good first issue Good for newcomers who would like to start contributing to the project. labels Oct 10, 2019
@humazed
Copy link
Author

humazed commented Oct 10, 2019 via email

@StijnWoerkom
Copy link
Contributor

StijnWoerkom commented Oct 10, 2019

@humazed I reproduced the demo app in the new Android 10 and with the Geolocator().checkGeolocationPermissionStatus() method and retrieved 0 errors when I choose to allow only while using the app. Could you send your code so I could take a look at it?

@humazed
Copy link
Author

humazed commented Oct 12, 2019

I just cloned the repo and ran it without any changes

@humazed
Copy link
Author

humazed commented Oct 12, 2019

I even created a new emulator in case my current one has a problem or something but getting the same behavior

@StijnWoerkom
Copy link
Contributor

I think the issue would depend more on the settings from the emulator. The app states that there are issues with Google Play Services. Are you using a network or are you at a location that does not support the Google Play Services?

@humazed
Copy link
Author

humazed commented Oct 15, 2019

I have tried with a fresh emulator but the problem is the same

The app works fine for any version lower than android10

In the gifs I provided I'm showing the version of Google play services and the the location is enabled

@PlymouthRock
Copy link

I have this same issue if using version 5.1.4+1 and compiling with SDK 28. If I compile on SDK 29 it works. Running this on a Pixel 3a running Android 10.

@adithyaxx
Copy link

I have this same issue if using version 5.1.4+1 and compiling with SDK 28. If I compile on SDK 29 it works. Running this on a Pixel 3a running Android 10.

I can confirm that setting compileSdkVersion and targetSdkVersion to 29 resolved this issue.

@tampiss
Copy link

tampiss commented Nov 13, 2019

I have the same issue.

@nachiketkhasbag
Copy link

nachiketkhasbag commented Nov 25, 2019

I see that with iOS too. getCurrentPosition() shows dialog box to enable location always or enable location while using the app or deny location access. Selecting "Enable while using the app" results in an exception with an error "PERMISISON_DENIED"

I am using geolocator 5.1.3

@ilya-sh-dev
Copy link

A similar error is reproduced on Pixel 4.

@DenisBogatirov
Copy link

Same issue.
Samsung Galaxy S10 Plus, when click on "Keep while-in-use access" get PermissionStatus.denied

@StijnWoerkom
Copy link
Contributor

We are currently working on a new version of the location permissions plugin. This new version includes respected while-in-use access and no longer returns PermissionStatus.denied.

@StijnWoerkom
Copy link
Contributor

@mulderpf
Copy link

mulderpf commented Jan 10, 2020

Urgh - I just discovered that I am experiencing the same issue for a production app. I had wrongly assumed that when a user gives in-use access permissions, this method would return PermissionStatus.granted - so I can no longer rely on this it seems.

EDIT: Two hours later, read the rest of the thread and realised that the suggestion of "I can confirm that setting compileSdkVersion and targetSdkVersion to 29 resolved this issue." works.

@JBBx2016
Copy link

"I can confirm that setting compileSdkVersion and targetSdkVersion to 29 resolved this issue." solved the issue until I added this in the AndroidManifest.xml

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

@StijnWoerkom
Copy link
Contributor

@JBBx2016 We are working on the android.permissions.ACCES_BACKGROUND_LOCATION permissions. When the permissions are fixed, it could solve your error.

@StijnWoerkom StijnWoerkom removed their assignment Jan 23, 2020
@mustakimpawle
Copy link

Any update?

@andreystavitsky
Copy link

any update?

@lkyashu
Copy link

lkyashu commented May 13, 2020

Any Update

@praveenb
Copy link

Not working on Android 10 devices. :|

@andreystavitsky
Copy link

As a temporary workaround, you can use my fork
branch Master
where I moved permission stuff from obviously broken location_permissions to another plugin permission_handler

@louia
Copy link

louia commented Jun 18, 2020

My app just stop working after Google Play service PopUp, what ever i answer "Deny" , "Authorize", etc. with Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
and with best it works fine
Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.best);
Android 10 with emulator, latest stable branch flutter.

@it-sam
Copy link

it-sam commented Jul 31, 2020

Geolocator locator = Geolocator();
    locator
        .checkGeolocationPermissionStatus(
            locationPermission: GeolocationPermission.locationWhenInUse)

Need to pass permission in params.
GeolocationPermission.locationWhenInUse

@mvanbeusekom
Copy link
Member

Fixed in version 6.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: android Issue is related to the Android platform. status: in progress Indicates that this issue is currently being worked on.
Projects
None yet
Development

No branches or pull requests