react-native-geolocation-service icon indicating copy to clipboard operation
react-native-geolocation-service copied to clipboard

Always getting timeout

Open pierroo opened this issue 6 years ago • 16 comments

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?

pierroo avatar Oct 09 '19 11:10 pierroo

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 ?

Agontuk avatar Oct 18 '19 13:10 Agontuk

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.

crocodile avatar Nov 27 '19 14:11 crocodile

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.

rawbeans avatar Dec 16 '19 20:12 rawbeans

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

rezasazesh avatar Jan 13 '20 11:01 rezasazesh

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?

ShaharyarMaroof avatar Feb 18 '20 13:02 ShaharyarMaroof

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 avatar Mar 04 '20 17:03 JamesTrickeyD

on android several solutions worked for me:

  1. set enableHighAccuracy to false
  2. on one emulator - opening google maps app solved the location issue for my app
  3. on a different emulator - restarting the emulator by a long press on the shut down button (regular shut down didn't work) Screen Shot 2020-03-04 at 19 27 22

idanhaviv avatar Mar 04 '20 17:03 idanhaviv

Opening Google Maps helped on Pixel API29 emulator, thank you!

on android several solutions worked for me:

  1. set enableHighAccuracy to false
  2. on one emulator - opening google maps app solved the location issue for my app
  3. on a different emulator - restarting the emulator by a long press on the shut down button (regular shut down didn't work)

deserthurricane avatar Apr 23 '20 14:04 deserthurricane

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 avatar May 06 '20 14:05 miralmsojitra

@miralmsojitra have you solved it yet? im also having the same issue in some devices most of the time.

salmanxoxo avatar May 14 '20 12:05 salmanxoxo

I have this error almost only on Android 10. Any clue?

Kamill90 avatar May 24 '20 18:05 Kamill90

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?

idanhaviv avatar May 28 '20 07:05 idanhaviv

Same issue here, having the problem with Android emulator(Genymotion) and iOS...

dagi3d avatar Jul 15 '20 11:07 dagi3d

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.

JamesTrickeyD avatar Jul 15 '20 11:07 JamesTrickeyD

enableHighAccuracy=true does not work on android.

nes123 avatar Aug 30 '20 10:08 nes123

enableHighAccuracy=true does not work on android emulator for me

rdgomt avatar Sep 10 '20 20:09 rdgomt