Flutterlocation: serviceEnabled return true in Android level 28

Created on 17 Sep 2019  路  11Comments  路  Source: Lyokone/flutterlocation

Describe the bug
1) Disable GPS
2) Call serviceEnabled
3) Return true

Expected behavior
Return false

Tested on:

  • Android, API Level 28. Real device - MI 9
inactive

Most helpful comment

This package worked like charm

https://github.com/alfanhui/new_geolocation

All 11 comments

I face the same behavior, and after checking multiple alternatives seems most of Flutter plugins behave the same way

To fix this, there are two concepts need to be separated

  • Location Service is Enabled (Android can get location from other services than GPS not sure about IOS)
  • GPS Service is Enabled to be more specific on checking GPS is enabled or not

I think this issue on other project can add more context
https://github.com/BaseflowIT/flutter-permission-handler/issues/85

As an extra note, I just pushed a PR to fix this issue
https://github.com/Lyokone/flutterlocation/pull/229

Seems to be working for me. What do you mean by Disable GPS?

You do know that it is an async function and you have to await it, right?

@aleksandr-m Just pull down the menu at the Android home page. Then click a 'GPS icon' to turn off it.

i add await already. Still have the issue. Not all android devices has this issue.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This is still an issue, getLocation only returns if device has been set to HIGH.
serviceEnabled always returns true, even when gps has been turned off on device.

Sounds related to #239.

Yes thats it @awhitford, thx for pointing me to that issue.

This package worked like charm

https://github.com/alfanhui/new_geolocation

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fre391 picture fre391  路  4Comments

otopba picture otopba  路  6Comments

lehno picture lehno  路  5Comments

RomanJos picture RomanJos  路  4Comments

Gintasz picture Gintasz  路  9Comments