-
Notifications
You must be signed in to change notification settings - Fork 117
Closed
Labels
location-layer-pluginIssues that deal with the location layer moduleIssues that deal with the location layer module
Description
I'm trying to get the user location using LocationEngine on Android devices , but when I star the app the usser's marker is located in (0.0, 0.0) and never update it's location.
How is it possible?
I try to replicate the example https://www.mapbox.com/android-docs/plugins/overview/location-layer/
`
private void enableLocationPlugin() {
// Check if permissions are enabled and if not request
if (PermissionsManager.areLocationPermissionsGranted(this)) {
// Create an instance of LOST location engine
initializeLocationEngine();
LocationLayerOptions options = LocationLayerOptions.builder(this)
.build();
locationLayerPlugin = new LocationLayerPlugin(mapView, mapboxMap, locationEngine, options);
locationLayerPlugin.setRenderMode(RenderMode.COMPASS);
locationLayerPlugin.setCameraMode(CameraMode.TRACKING);
locationLayerPlugin.setLocationLayerEnabled(true);
} else {
permissionsManager = new PermissionsManager(this);
permissionsManager.requestLocationPermissions(this);
}
}
private void initializeLocationEngine() {
locationEngine = new LocationEngineProvider(this).obtainBestLocationEngineAvailable();
locationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY);
locationEngine.setInterval(1000);
locationEngine.setFastestInterval(500);
locationEngine.addLocationEngineListener(this);
locationEngine.activate();
locationEngine.requestLocationUpdates();
Location lastLocation = locationEngine.getLastLocation();
if (lastLocation != null) {
setCameraPosition(lastLocation);
locationEngine.addLocationEngineListener(this);
} else {
locationEngine.addLocationEngineListener(this);
}
}
`
I'm using this version of MapBox in grandle
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-building:0.2.0' implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.12.0' implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer:0.5.2'
Metadata
Metadata
Assignees
Labels
location-layer-pluginIssues that deal with the location layer moduleIssues that deal with the location layer module
