question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getLocation() never return if user don't accept to use Google location service

See original GitHub issue

Describe the bug On Android, when user is prompted to enable Google location service, if say “No Thanks”, the getLocation method hangs and never return. No error is throw.

Expected behavior Must return the location or some error if it’s not possible.

Tested on:

  • Android, API Level 28, simulator and Moto G device
  • iOS, Version 12, simulator and real device (SE). Works fine

Additional logs

  • There’s just one log that would indicate something…
W/System  (15921): A resource failed to call release.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
aleksandr-mcommented, Sep 7, 2019

Workaround:

bool getloc = false;
if (await _location.serviceEnabled()) {
  getloc = true;
} else {
  getloc = await _location.requestService();
}
if (getloc) {
  currentLocation = await _location.getLocation();
}
1reaction
Lyokonecommented, Feb 23, 2020

Hey ! Should be fixed with 2.5.0, please reopen if this still happens 😃 Thanks for your patience 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to get user location in flutter app - Stack Overflow
This is the method I use to get location. Hope it helps. void _getLocation() async { var location = new Location(); try {...
Read more >
Requesting access to location in the background
Your app should not request access to location in the background unless it's required. If your app requests access to location in the...
Read more >
Request location permissions - Android Developers
... Google Play services for cars · Notifications on Android Automotive OS ... Create and monitor geofences · Detect when users start an...
Read more >
Place Autocomplete | Maps JavaScript API - Google Developers
The API does not return results outside this region even if they match the user ... On calling getPlace() on the Autocomplete object,...
Read more >
location | Flutter Package - Pub.dev
Remember that the user has to accept the location permission to always allow to use the background location. The Android 11 option to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found