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.

Geolocation timed out, code 3

See original GitHub issue

Description

I have geolocation running in my app, followed examples described in docs. IOS version works fine, android however works only on non xiaomi devices. I tried on 2 xiamomi devices, and got Location request timed out error. While on samsung devices it works fine.

Reproduction

navigator.geolocation.getCurrentPosition(
            (position) => {
                let initialPosition = JSON.stringify(position);
                console.log(initialPosition);
            },
            (error) => console.log(JSON.stringify(error)),
            {enableHighAccuracy: Platform.OS != 'android', timeout: 2000, maximumAge: 2000 }
        );

Solution

Need to find a way either provide reason why timed out, or just fix it.

Additional Information

  • React Native version: 0.42
  • Platform: Android
  • Operating System: Mac OS
  • Dev tools: Android SDK v23

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:20
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

32reactions
nicotroiacommented, Aug 23, 2017

For anyone else struggling with this issue on android, try removing the maximumAge: 2000 option parameter. This option was causing geolocation to either timeout or crash the app.

I’m running react-native 0.46.4 btw.

23reactions
hramoscommented, Jul 25, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we’re automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Android location request timed out - Stack Overflow
When my app cannot find my location, I tried via Google Maps app, it works like charm. Here is my code for both...
Read more >
Geolocation Error: Time out code 3 - Google Groups
I've got the latest phonegap 1.2 and put the test code from the docs in my application. When I run my app both...
Read more >
Solve “Location request timed out” problem when ... - Steve Mu
Solve “Location request timed out” problem when using geolocation in React Native. It took me a few hours just to make the navigator.geolocation...
Read more >
[Location Plugin] GetLocation always has error Timeout ...
When running the application as a mobile app in an Android device, if the location cannot be retrieved in time, a "Position retrieval...
Read more >
Geolocation-error-code-3 - npm.io
A workaround to get over the issue: "Geolocation timed out. Code 3". I just worked with Android OS only. In React Native docs....
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