File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
app/src/main/java/de/stephanlindauer/criticalmaps/managers Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ public class LocationUpdateManager {
3737 private final PermissionCheckHandler permissionCheckHandler ;
3838 private final App app ;
3939 private boolean isUpdating = false ;
40+ private boolean isEventBusRegistered = false ;
4041
4142 private static final float LOCATION_REFRESH_DISTANCE = 20 ; //20 meters
4243 private static final long LOCATION_REFRESH_TIME = 12 * 1000 ; //12 seconds
@@ -160,7 +161,11 @@ public void initialize() {
160161 } else {
161162 setStatusEvent ();
162163 }
163- eventBus .register (this );
164+
165+ if (!isEventBusRegistered ) {
166+ eventBus .register (this );
167+ isEventBusRegistered = true ;
168+ }
164169
165170 // Short-circuit here: if no provider exists don't start listening
166171 if (noProviderExists ) {
@@ -232,6 +237,7 @@ public void handleShutdown() {
232237 } catch (IllegalArgumentException ignored ) {
233238 // nothing we can do
234239 }
240+ isEventBusRegistered = false ;
235241 }
236242
237243 private void publishNewLocation (Location location ) {
You can’t perform that action at this time.
0 commit comments