Skip to content

Commit

Permalink
Merge pull request #781 from mapbox/bugfix/768
Browse files Browse the repository at this point in the history
[Android] Check that we have location permissions enabled
  • Loading branch information
nitaliano authored Nov 17, 2017
2 parents 729c5fb + 4279aac commit f9027b5
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import com.mapbox.services.android.telemetry.location.LocationEngine;
import com.mapbox.services.android.telemetry.location.LocationEngineListener;
import com.mapbox.services.android.telemetry.location.LocationEnginePriority;
import com.mapbox.services.android.telemetry.permissions.PermissionsManager;
import com.mapbox.services.commons.geojson.Feature;
import com.mapbox.services.commons.geojson.FeatureCollection;
import com.mapbox.services.commons.geojson.Point;
Expand Down Expand Up @@ -777,6 +778,10 @@ public void onHostDestroy() {
}

private void enableLocationLayer() {
if (!PermissionsManager.areLocationPermissionsGranted(mContext)) {
return;
}

if (mLocationEngine == null) {
mLocationEngine = new LostLocationEngine(mContext);
mLocationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY);
Expand Down

0 comments on commit f9027b5

Please sign in to comment.