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

Geolocation only works if I use React Native Maps with showsUserLocation prop

Open Lea23VC opened this issue 3 years ago • 10 comments

The geolocation give bad coords and always give the same ones, they don't update, but if I add the "showsUserLocation" prop to the MapView from React Native Maps, the geolocation service starts to work without any problem.

I don't know what I'm doing wrong, the app has the permissions and I updated the android xml with , , and even

Lea23VC avatar Sep 05 '21 05:09 Lea23VC

Any news @Lea23VC ? I'm having the same issues as you.

hgvo9 avatar Sep 13 '21 02:09 hgvo9

Same problem here

update: managed to solve it by now with @Lea23VC solution

p-ugulino avatar Sep 13 '21 14:09 p-ugulino

The geolocation give bad coords and always give the same ones, they don't update, but if I add the "showsUserLocation" prop to the MapView from React Native Maps, the geolocation service starts to work without any problem.

I don't know what I'm doing wrong, the app has the permissions and I updated the android xml with , , and even

GOD

daniele-mc avatar Sep 13 '21 14:09 daniele-mc

Same problem here

update: managed to solve it by now with @Lea23VC solution

Thank you for your answer, I'm afraid I can't see @Lea23VC solution, could you please link it me ?

hgvo9 avatar Sep 14 '21 04:09 hgvo9

Same problem here update: managed to solve it by now with @Lea23VC solution

Thank you for your answer, I'm afraid I can't see @Lea23VC solution, could you please link it me ?

Hello! We managed to get it solved adding "showsUserLocation" on the MapView we have.

p-ugulino avatar Sep 14 '21 19:09 p-ugulino

Hello guys

My problem is that I can't use geolocation without "showsUserLocation", but want to use it without that prop. I want to use a custom marker, not that blue dot

Lea23VC avatar Sep 14 '21 19:09 Lea23VC

Hello guys

My problem is that I can't use geolocation without "showsUserLocation", but want to use it without that prop. I want to use a custom marker, not that blue dot

Yes indeed, I want to use a custom marker too, weird enough it works on iOS without the prop "showsUserLocation" but on Android it doesn't ...

hgvo9 avatar Sep 15 '21 00:09 hgvo9

I think you are not asking for the ACCESS_FINE_LOCATION permission.

sdandois avatar Dec 20 '21 13:12 sdandois

Provide a code sample, how are you using this library to get location ?

Agontuk avatar May 27 '22 12:05 Agontuk

I have the same issue, have both permissions in the manifest but it doesn't actual provide the permissions.

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

EDIT:

Seems like you need to prompt the user with

import { PermissionsAndroid } from 'react-native';


await PermissionsAndroid.requestMultiple([
  'android.permission.ACCESS_COARSE_LOCATION',
  'android.permission.ACCESS_FINE_LOCATION'
]);

should probably be added to the setup instructions, or part of the request authorization api call and NOT labelled iOS only.

CDBridger avatar Nov 29 '22 21:11 CDBridger