react-native-geolocation-service
react-native-geolocation-service copied to clipboard
Always getting timeout
Hi,
I keep getting timeout with this library as well, even using the latest version (v3.1.0). My device is samsung android 5.0
Whether I am on wifi or data, same result.
Tried to restart the phone, turn off/on gps, same result.
I am using the following parameters:
{ enableHighAccuracy: true, timeout: 10000, maximumAge: 10000 }, with Geolocation.getCurrentPosition(...)
Can you confirm there is no need for an API key with this library?
Also, it is mentionned in the docs that for react native version >0.60 we need no extra steps for android; but in my app/build.gradle for example, I don't have the line:
implementation project(':react-native-geolocation-service')
does that mean I should actually do it manually?
What is the response you're getting ? If it's code: 3, then you don't need to setup manually. Can you checkout the FAQ section and see if it solves your problem ?
Leaving this here in case anybody else ends up here with a similar "always getting a timeout" issue:
I was also getting a time out. I found that If I already have "Geolocation.watchPosition" running "Geolocation.getCurrentPosition" will not work with a time out (error code 3). This is on IOS, on Android I didn't have this issue.
I was getting this same error on Android, but not iOS. For me, the fix was to set the timeout higher than the default. I set it to 15000. This doesn't seem to be the OP's issue though.
Note: The documentation says that they default timeout is INFINITY. Therefore it appears there is a bug.
I faced this issue also and I saw an error in xcode's logger that helped me, make sure you have all of these keys in the info.plist and all with a string to explain them:
NSLocationWhenInUseUsageDescription
NSLocationWhenInUseUsageDescription
NSLocationAlwaysAndWhenInUseUsageDescription
hey I am also facing this issue, both on android and iOS. I have the permission strings in my info.plist as well. for android I am getting the following error {message: "Location request timed out.", code: 3}
any idea how to fix it?
I have just started getting this too - Android only. Was working fine a couple of days ago.
- will note back if i can figure out what has changed.
on android several solutions worked for me:
- set enableHighAccuracy to false
- on one emulator - opening google maps app solved the location issue for my app
- on a different emulator - restarting the emulator by a long press on the shut down button (regular shut down didn't work)

Opening Google Maps helped on Pixel API29 emulator, thank you!
on android several solutions worked for me:
- set enableHighAccuracy to false
- on one emulator - opening google maps app solved the location issue for my app
- on a different emulator - restarting the emulator by a long press on the shut down button (regular shut down didn't work)
I have just started getting this too - Android only. Was working fine a couple of days ago.
- will note back if i can figure out what has changed.
@JamesTrickeyD did you found any solution? i am having same issue since 2 weeks.
@miralmsojitra have you solved it yet? im also having the same issue in some devices most of the time.
I have this error almost only on Android 10. Any clue?
I keep getting this timeout mostly on ios i'm setting
if (Platform.OS === "ios") { Geolocation.setRNConfiguration({authorizationLevel: 'whenInUse'}); }
and using this config:
enableHighAccuracy: false, timeout: 15000, maximumAge: 10000
anyone has any hint on this?
Same issue here, having the problem with Android emulator(Genymotion) and iOS...
I have just started getting this too - Android only. Was working fine a couple of days ago.
- will note back if i can figure out what has changed.
@JamesTrickeyD did you found any solution? i am having same issue since 2 weeks.
Sorry - the problem did resolve for us but I have no idea what happened.
I thought it was when we set enableHighAccuracy to false in the manifest (as we don't require it), but judging from what you guys are saying, maybe it wasn't that.
enableHighAccuracy=true does not work on android.
enableHighAccuracy=true does not work on android emulator for me