Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public LocationLayerPlugin(@NonNull MapView mapView, @NonNull MapboxMap mapboxMa
this.mapboxMap = mapboxMap;
this.mapView = mapView;
options = LocationLayerOptions.createFromAttributes(mapView.getContext(), R.style.mapbox_LocationLayer);
initializeLocationEngine();
initialize();
}

Expand Down Expand Up @@ -488,6 +487,7 @@ void onLocationLayerStop() {
}

private void initialize() {
initializeLocationEngine();
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);

mapboxMap.addOnMapClickListener(onMapClickListener);
Expand All @@ -512,11 +512,13 @@ private void initialize() {
}

private void initializeLocationEngine() {
usingInternalLocationEngine = true;
locationEngine = new LocationEngineProvider(mapView.getContext()).obtainBestLocationEngineAvailable();
locationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY);
locationEngine.setFastestInterval(1000);
locationEngine.activate();
if (locationEngine == null) {
usingInternalLocationEngine = true;
locationEngine = new LocationEngineProvider(mapView.getContext()).obtainBestLocationEngineAvailable();
locationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY);
locationEngine.setFastestInterval(1000);
locationEngine.activate();
}
}

private void enableLocationLayerPlugin() {
Expand Down