getCurrentLocation timeout and watchPosition not working with Android Emulator
See original GitHub issueI just upgraded to Android Studio Arctic Fox 2020.3.1 and Android Emulator 30.7.5, and am now having trouble getting a GPS position returned within the emulator. I’m running Android Studio in Linux, although I’m not sure that matters.
I appear to have all permissions granted, in that the Location permissions show under Location settings in the emulator and a copy of hasLocationPermissions()
from the example app returns true
. I’ve set the timeout quite high (20 seconds), and am never getting a value back. I have also added a position watch and nothing seems to come back from there.
adb logcat
doesn’t appear to show anything interesting related to the GPS from what I can tell. No obvious errors are spit out to react native or logcat while starting up the app.
I’m not sure where else exactly I should be looking to try to debug this issue.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (1 by maintainers)
Top GitHub Comments
So the issue turns out to be that the default value of
PRIORITY_BALANCED_POWER_ACCURACY
for the accuracy just… doesn’t work in the emulator? I just happened to try it in my native testing code and swapped over to that value from the values I had inserted based on the Android tutorials for setting up a location request, which instruct you to usePRIORITY_HIGH_ACCURACY
.After switching my native code test to use the balanced settings, I got the same
isLocationAvailable: false
value. Just changing my RN-level code to requestaccuracy: { android: 'high' }
fixed all of the problems I was seeing.My only recommendation from this bug would be to perhaps throw a warning/error if
isLocationAvailable
is false, even ifisLocationEnabled
is true. I will leave it open for the time being in hopes other people may find it if they run into the same weird issue.I can fix it
On Thu, Dec 8, 2022 at 12:27 PM Efstathios Ntonas @.***> wrote: