Skip to content

Fix failing location activities#307

Merged
Guardiola31337 merged 5 commits into
masterfrom
301-location-engine
Feb 7, 2017
Merged

Fix failing location activities#307
Guardiola31337 merged 5 commits into
masterfrom
301-location-engine

Conversation

@Guardiola31337

@Guardiola31337 Guardiola31337 commented Feb 6, 2017

Copy link
Copy Markdown
Contributor

Fixes #301

Added some WeakReference's to avoid unwanted memory leaks.

👀 @zugaldia

@mention-bot

Copy link
Copy Markdown

@Guardiola31337, thanks for your PR! By analyzing the history of the files in this pull request, we identified @cammace and @zugaldia to be potential reviewers.

@zugaldia zugaldia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small note to avoid ignoring a location value. Great call on using a WeakReference for the engines, could you bring that change to https://github.com/mapbox/mapbox-gl-native/blob/master/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java#L39 as well?

@Override
public void onLocationChanged(Location location) {
if (location != null) {
getLastLocation();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Guardiola31337 We're ignoring the location value passed to onLocationChanged here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we're not requesting location updates, so it's not necessary.
Problem. Are we going to leave onLocationChanged method empty? Should we segregate LocationEngineListener interface so client is not forced to depend on methods it does not use? What do you think? @zugaldia

@zugaldia zugaldia Feb 7, 2017

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Guardiola31337 It's only one method so it doesn't bring a lot of overhead, it keeps things simple. I'd leave it like it is right now. Also, it's more consistent with LocationListener this way.

@zugaldia

zugaldia commented Feb 7, 2017

Copy link
Copy Markdown
Member

@Guardiola31337 All good. If you want, and this is a minor thing, you could add a comment to the onLocationChanged() method simply saying that's unused on purpose for anyone reading the example.

@Guardiola31337 Guardiola31337 merged commit 455d795 into master Feb 7, 2017
@Guardiola31337 Guardiola31337 deleted the 301-location-engine branch February 7, 2017 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants