From 151f299b9881aa7e11430e589355b2b828a1a824 Mon Sep 17 00:00:00 2001 From: Cameron Mace Date: Mon, 21 May 2018 13:04:09 -0400 Subject: [PATCH] enable/disable inside lifecycle methods --- .../plugins/locationlayer/LocationLayerPlugin.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin-locationlayer/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayerPlugin.java b/plugin-locationlayer/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayerPlugin.java index 8edb7b26b..8dd1de18f 100644 --- a/plugin-locationlayer/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayerPlugin.java +++ b/plugin-locationlayer/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayerPlugin.java @@ -416,7 +416,7 @@ public void removeOnLocationStaleListener(@NonNull OnLocationStaleListener liste @RequiresPermission(anyOf = {ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION}) @OnLifecycleEvent(Lifecycle.Event.ON_START) public void onStart() { - onLocationLayerStart(); + enableLocationLayerPlugin(); if (isEnabled) { mapView.addOnMapChangedListener(onMapChangedListener); } @@ -429,7 +429,7 @@ public void onStart() { */ @OnLifecycleEvent(Lifecycle.Event.ON_STOP) public void onStop() { - onLocationLayerStop(); + disableLocationLayerPlugin(); mapView.removeOnMapChangedListener(onMapChangedListener); } @@ -515,7 +515,7 @@ private void updateMapWithOptions(final LocationLayerOptions options) { * @since 0.1.0 */ private void updateLocation(final Location location) { - if (location == null) { + if (location == null || !isEnabled) { return; } staleStateManager.updateLatestLocationTime();