use of com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin in project mapbox-plugins-android by mapbox.
the class LocationLayerMapChangeActivity method onMapReady.
@Override
public void onMapReady(MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
locationEngine = new LocationEngineProvider(this).obtainBestLocationEngineAvailable();
locationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY);
locationEngine.activate();
locationPlugin = new LocationLayerPlugin(mapView, mapboxMap, locationEngine);
locationPlugin.setRenderMode(RenderMode.COMPASS);
getLifecycle().addObserver(locationPlugin);
}
use of com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin in project mapbox-plugins-android by mapbox.
the class LocationLayerModesActivity method onMapReady.
@SuppressLint("MissingPermission")
@Override
public void onMapReady(MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
locationEngine = new LocationEngineProvider(this).obtainBestLocationEngineAvailable();
locationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY);
locationEngine.setFastestInterval(1000);
locationEngine.addLocationEngineListener(this);
locationEngine.activate();
int[] padding;
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
padding = new int[] { 0, 750, 0, 0 };
} else {
padding = new int[] { 0, 250, 0, 0 };
}
LocationLayerOptions options = LocationLayerOptions.builder(this).padding(padding).build();
locationLayerPlugin = new LocationLayerPlugin(mapView, mapboxMap, locationEngine, options);
locationLayerPlugin.addOnLocationClickListener(this);
locationLayerPlugin.addOnCameraTrackingChangedListener(this);
locationLayerPlugin.setCameraMode(cameraMode);
setRendererMode(renderMode);
getLifecycle().addObserver(locationLayerPlugin);
}
use of com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin in project mapbox-navigation-android by mapbox.
the class RerouteActivity method onMapReady.
@SuppressLint("MissingPermission")
@Override
public void onMapReady(MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
mapboxMap.setOnMapClickListener(this);
locationLayerPlugin = new LocationLayerPlugin(mapView, mapboxMap, null);
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.NAVIGATION);
// Setup the mockLocationEngine
mockLocationEngine = new MockLocationEngine(1000, 30, false);
mockLocationEngine.addLocationEngineListener(this);
navigation.setLocationEngine(mockLocationEngine);
// Acquire the navigation route
getRoute(origin, destination, null);
}
Aggregations