use of com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin in project mapbox-plugins-android by mapbox.
the class ManualLocationUpdatesActivity method onMapReady.
@Override
@SuppressWarnings({ "MissingPermission" })
public void onMapReady(MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
locationEngine = new LocationEngineProvider(this).obtainBestLocationEngineAvailable();
locationEngine.addLocationEngineListener(this);
locationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY);
locationEngine.activate();
locationLayerPlugin = new LocationLayerPlugin(mapView, mapboxMap, null);
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
getLifecycle().addObserver(locationLayerPlugin);
}
use of com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin in project mapbox-navigation-android by mapbox.
the class MockNavigationActivity method onMapReady.
@Override
public void onMapReady(MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
locationLayerPlugin = new LocationLayerPlugin(mapView, mapboxMap, null);
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.NAVIGATION);
navigationMapRoute = new NavigationMapRoute(navigation, mapView, mapboxMap);
mapboxMap.addOnMapClickListener(this);
Snackbar.make(mapView, "Tap map to place waypoint", BaseTransientBottomBar.LENGTH_LONG).show();
locationEngine = new MockLocationEngine(1000, 50, true);
mapboxMap.setLocationSource(locationEngine);
newOrigin();
}
use of com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin in project mapbox-navigation-android by mapbox.
the class NavigationViewActivity method initLocationLayer.
@SuppressWarnings({ "MissingPermission" })
private void initLocationLayer() {
locationLayer = new LocationLayerPlugin(mapView, mapboxMap, locationEngine);
locationLayer.setLocationLayerEnabled(LocationLayerMode.COMPASS);
}
use of com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin in project mapbox-navigation-android by mapbox.
the class NavigationView method initLocationLayer.
/**
* Initializes the {@link LocationLayerPlugin} to be used to draw the current
* location.
*/
@SuppressWarnings({ "MissingPermission" })
private void initLocationLayer() {
int locationLayerStyleRes = ThemeSwitcher.retrieveNavigationViewStyle(getContext(), R.attr.navigationViewLocationLayerStyle);
locationLayer = new LocationLayerPlugin(mapView, map, null, locationLayerStyleRes);
locationLayer.setLocationLayerEnabled(LocationLayerMode.NAVIGATION);
}
use of com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin 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