react-native-mapbox-gl icon indicating copy to clipboard operation
react-native-mapbox-gl copied to clipboard

showUserLocation not working on Android

Open EffectusSanti opened this issue 6 years ago • 7 comments

The map is working fine on iOS, but I can't see the user location on Android (zoom and coords aren't working well either).

I followed the installation instructions and have the FINE_LOCATION and other permissions granted.

The only thing I changed was in my build.gradle, to prevent the app from crashing:

compile (project(':mapbox-react-native-mapbox-gl')) {
        compile ('com.squareup.okhttp3:okhttp:3.6.0') {
            force = true
        }
}

EffectusSanti avatar Jan 18 '19 17:01 EffectusSanti

I'm having the same issue

ghost avatar Jan 18 '19 17:01 ghost

I'm also having this problem

kgelpes avatar Jan 18 '19 18:01 kgelpes

what location engine are you using?

nitaliano avatar Feb 06 '19 20:02 nitaliano

Same here on Android, but working well on iOS emulator.

nicoceledon avatar Mar 20 '19 01:03 nicoceledon

what location engine are you using?

I have this issue as well, adding the parameter userTrackingMode makes the map break.

alexiri avatar Mar 20 '19 11:03 alexiri

Doing some testing, i still haven't figure this out completely but i tried requesting permissions like this and it worked (reference link)

import { PermissionsAndroid } from 'react-native';
...
componentDidMount() {
{
 PermissionsAndroid.requestMultiple(
            [PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
            PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION],
            {
                title: 'Give Location Permission',
            message: 'App needs location permission to find your position.'
        }
    ).then(granted => {
        console.log(granted);
        resolve();
    }).catch(err => {
        console.warn(err);
        reject(err);
    });
}

And i was able to pickup the location and zoom in. I'm still having troubles though. I have to restart the app to show the location. I guess it has to do with where i'm requesting the permissions. I don't have the permissions in the AndroidManifest.xml.

Android: 8.0 react-native: 0.56.0 react-native-mapbox-gl: 6.1.3

nicoceledon avatar Mar 20 '19 12:03 nicoceledon

still not working for me

tahir-jamil avatar Apr 24 '20 19:04 tahir-jamil