Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geolocation getCurrentLocation request times out when GPS is turned off then on again #16903

Closed
vydingding opened this issue Nov 21, 2017 · 9 comments
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@vydingding
Copy link

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

@hemedani
Copy link

hemedani commented Nov 21, 2017

i have the same issue ...
i use this package for turning on location on android react-native-android-location-services-dialog-box when i turned on location and get back to app getCurrentLocation request gets timed out.

@damsorian
Copy link

damsorian commented Dec 26, 2017

Same issue with the getCurrentPosition: {message: "Location request timed out", code: 3}

@guopeng1994
Copy link

me too!

RN: 0.51.0
React:16.0.0-alpha.12
Platform:Android 6.0

@zaplo00
Copy link

zaplo00 commented Feb 27, 2018

Happens always, at least in RN 0.49 and 0.53

@stale
Copy link

stale bot commented May 28, 2018

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label May 28, 2018
@hemedani
Copy link

it's not solved please don't close it

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label May 28, 2018
@damsorian
Copy link

damsorian commented May 28, 2018

I solved the getCurrentPosition issue with the enableHighAccuracy, this is the workaround:

const getCurrentPosition = (onSuccess, onError, error3) => {
  navigator.geolocation.getCurrentPosition(
    (position) => onSuccess(position),
    (err) => {
      if (err.code === 3 && !error3) {
        getCurrentPosition(onSuccess, onError, true);
      } else {
        onError(err);
      }
    },
    { enableHighAccuracy: !error3, timeout: 5000 },
  );
};

getCurrentPosition(
  (position) => console.log('position', position),
  (error) => console.log('position error', error),
)

@stale
Copy link

stale bot commented Aug 26, 2018

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 26, 2018
@stale
Copy link

stale bot commented Sep 6, 2018

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Sep 6, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Sep 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

5 participants