use of com.mapbox.android.core.location.LocationEngine in project mapbox-plugins-android by mapbox.
the class CompassListenerActivity method onMapReady.
@Override
public void onMapReady(final MapboxMap mapboxMap) {
LocationEngine locationEngine = new LocationEngineProvider(this).obtainBestLocationEngineAvailable();
locationLayerPlugin = new LocationLayerPlugin(mapView, mapboxMap, locationEngine);
locationLayerPlugin.setRenderMode(RenderMode.COMPASS);
locationLayerPlugin.addCompassListener(new CompassListener() {
@Override
public void onCompassChanged(float userHeading) {
CameraPosition cameraPosition = new CameraPosition.Builder().bearing(userHeading).build();
mapboxMap.easeCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
@Override
public void onCompassAccuracyChange(int compassStatus) {
Timber.v("Compass reading: %d", compassStatus);
}
});
}
Aggregations