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.getCurrentPosition #358

Open
anumate78 opened this issue Mar 12, 2025 · 3 comments
Open

Geolocation.getCurrentPosition #358

anumate78 opened this issue Mar 12, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@anumate78
Copy link

anumate78 commented Mar 12, 2025

Geolocation.getCurrentPosition this method is not working properly please look it. gps is on location permissions also there but showing this. please look on urgent basis

{"ACTIVITY_NULL": 4, "PERMISSION_DENIED": 1, "POSITION_UNAVAILABLE": 2, "TIMEOUT": 3, "code": 3, "message": "Location request timed out"} its showing this

@anumate78 anumate78 added the bug Something isn't working label Mar 12, 2025
@anuragchachan
Copy link

anuragchachan commented Mar 12, 2025

Geolocation.getCurrentPosition doesnot work properly when enableHighAccuracy: true . try keeping enableHighAccuracy: false it will not give error. It will work but may not give exact location.
I have also used like this for time being waiting for it be fixed in future updates.

Geolocation.getCurrentPosition(
position => {
const coordinate = {
latitude: position?.coords.latitude,
longitude: position?.coords.longitude,
};

    setCoordinates(coordinate);
  },
  error => {
    showAlert({
      message: error.message || 'Failed to get location. Please try again.',
      type: 'error',
    });
  },
  {enableHighAccuracy: false, timeout: 10000},
);

@divyong
Copy link

divyong commented Mar 17, 2025

I have same issue, but only on API level 35 (Android 15), when i run app on any other android version it works correct

RN version 70.6 (i also tried clear 75.5 project)
Maybe i need latest? but it depends very lot difficulties to upgrade my project

I tried all the advice I could find on the internet
the enableHighAccuracy does not affect anything

Also tried react-native-golocation-service, but its returns same

Any suggestions?

@dws-krisha
Copy link

Having the same issue while fetching current position in Android.
It works on emulator but doesn't work on real device
{"ACTIVITY_NULL": 4, "PERMISSION_DENIED": 1, "POSITION_UNAVAILABLE": 2, "TIMEOUT": 3, "code": 3, "message": "Location request timed out"} its showing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants