mrmans0n/smart-location-lib

Change LocationProvider on fly

jidesoft opened this issue · 0 comments

In my app, I need to change the location provider on fly by calling location(...) method. However I noticed it works the first time but never again. Then I found the code below which prevents me from changing the provider. Since the smartLocation.context is the same, it always gets the first location provider it was ever set. Any reason for the code below?

        if (!MAPPING.containsKey(smartLocation.context)) {
              MAPPING.put(smartLocation.context, locationProvider);
          }

          this.provider = (LocationProvider)MAPPING.get(smartLocation.context);