use of com.mapbox.mapboxsdk.location.LocationComponent in project apps-android-wikipedia by wikimedia.
the class NearbyFragment method enableUserLocationMarker.
@SuppressWarnings("MissingPermission")
private void enableUserLocationMarker() {
if (mapboxMap != null && locationPermitted()) {
LocationComponentOptions options = LocationComponentOptions.builder(requireActivity()).trackingGesturesManagement(true).build();
LocationComponent locationComponent = mapboxMap.getLocationComponent();
locationComponent.activateLocationComponent(requireActivity(), mapboxMap.getStyle(), options);
locationComponent.setLocationComponentEnabled(true);
locationComponent.setCameraMode(CameraMode.TRACKING);
locationComponent.setRenderMode(RenderMode.COMPASS);
}
}
use of com.mapbox.mapboxsdk.location.LocationComponent in project apps-android-commons by commons-app.
the class LocationPickerActivity method enableLocationComponent.
/**
* Enables location components
* @param loadedMapStyle Style
*/
@SuppressWarnings({ "MissingPermission" })
private void enableLocationComponent(@NonNull final Style loadedMapStyle) {
final UiSettings uiSettings = mapboxMap.getUiSettings();
uiSettings.setAttributionEnabled(false);
// Check if permissions are enabled and if not request
if (PermissionsManager.areLocationPermissionsGranted(this)) {
// Get an instance of the component
final LocationComponent locationComponent = mapboxMap.getLocationComponent();
// Activate with options
locationComponent.activateLocationComponent(LocationComponentActivationOptions.builder(this, loadedMapStyle).build());
// Enable to make component visible
locationComponent.setLocationComponentEnabled(true);
// Set the component's camera mode
locationComponent.setCameraMode(CameraMode.NONE);
// Set the component's render mode
locationComponent.setRenderMode(RenderMode.NORMAL);
}
}
use of com.mapbox.mapboxsdk.location.LocationComponent in project mapbox-plugins-android by mapbox.
the class PlacePickerActivity method enableLocationComponent.
@SuppressWarnings({ "MissingPermission" })
private void enableLocationComponent(@NonNull Style loadedMapStyle) {
// Check if permissions are enabled and if not request
if (PermissionsManager.areLocationPermissionsGranted(this)) {
// Get an instance of the component
LocationComponent locationComponent = mapboxMap.getLocationComponent();
// Activate with options
locationComponent.activateLocationComponent(LocationComponentActivationOptions.builder(this, loadedMapStyle).build());
// Enable to make component visible
locationComponent.setLocationComponentEnabled(true);
// Set the component's camera mode
locationComponent.setCameraMode(CameraMode.NONE);
// Set the component's render mode
locationComponent.setRenderMode(RenderMode.NORMAL);
addUserLocationButton();
} else {
permissionsManager = new PermissionsManager(this);
permissionsManager.requestLocationPermissions(this);
}
}
Aggregations