Skip to content
This repository has been archived by the owner on Apr 23, 2023. It is now read-only.

Report last known location when engine enabled #148

Merged
merged 2 commits into from
Dec 8, 2016

Conversation

sarahsnow1
Copy link
Contributor

@sarahsnow1 sarahsnow1 commented Dec 6, 2016

Overview

This PR updates the FusionEngine to check for a last known location for each enabled location provider and return that location if it exists.

Proposed Changes

Here is example output from these two test classes used

FusedLocationActivity

12-06 15:53:11.558 1765-1765/com.mapzen.googleplayservicestest D/Test: onConnected
12-06 15:53:11.568 1765-1765/com.mapzen.googleplayservicestest D/Test: last known network
12-06 15:53:11.568 1765-1765/com.mapzen.googleplayservicestest D/Test: ch acc:2198.0 lat:40.0173948 lng:-105.3028802 provider:network bearing:0.0 nanos:6514803000000 speed:0.0 time:1481064657644
12-06 15:53:11.568 1765-1765/com.mapzen.googleplayservicestest D/Test: lastKnownLocation
12-06 15:53:11.568 1765-1765/com.mapzen.googleplayservicestest D/Test: ch acc:2198.0 lat:40.0173948 lng:-105.3028802 provider:fused bearing:0.0 nanos:6648737000000 speed:0.0 time:1481064791578
12-06 15:53:11.578 1765-1765/com.mapzen.googleplayservicestest D/Test: Location Changed
12-06 15:53:11.578 1765-1765/com.mapzen.googleplayservicestest D/Test: ch acc:2198.0 lat:40.0173948 lng:-105.3028802 provider:fused bearing:0.0 nanos:6648746000000 speed:0.0 time:1481064791587

LostFusedLocationActivity

12-06 15:50:57.598 30873-30873/com.mapzen.googleplayservicestest D/Test: onConnected
12-06 15:50:57.598 30873-30873/com.mapzen.googleplayservicestest D/Test: last known network
12-06 15:50:57.598 30873-30873/com.mapzen.googleplayservicestest D/Test: ch acc:2198.0 lat:40.0173948 lng:-105.3028802 provider:network bearing:0.0 nanos:6477295000000 speed:0.0 time:1481064620137
12-06 15:50:57.598 30873-30873/com.mapzen.googleplayservicestest D/Test: lastKnownLocation
12-06 15:50:57.598 30873-30873/com.mapzen.googleplayservicestest D/Test: ch acc:2198.0 lat:40.0173948 lng:-105.3028802 provider:network bearing:0.0 nanos:6477295000000 speed:0.0 time:1481064620137
12-06 15:50:57.608 30873-30873/com.mapzen.googleplayservicestest D/Test: Location Changed
12-06 15:50:57.608 30873-30873/com.mapzen.googleplayservicestest D/Test: ch acc:2198.0 lat:40.0173948 lng:-105.3028802 provider:network bearing:0.0 nanos:6477295000000 speed:0.0 time:1481064620137

FusedLocationActivity.txt
LostFusedLocationActivity.txt

Closes #141

checkLastKnownAndNotify(PASSIVE_PROVIDER);
}

private void checkLastKnownAndNotify(String provider) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

For location requests with PRIORITY_HIGH_ACCURACY this method would be invoked for both GPS_PROVIDER and NETWORK_PROVIDER resulting in two initial location updates.

We should only send one initial location update and use the logic in FusionEngine.getLastLocation() to decide which one is best.

@ecgreb ecgreb merged commit de945b3 into master Dec 8, 2016
@ecgreb ecgreb deleted the 141-send-initial-location branch December 8, 2016 16:23
@ecgreb ecgreb removed the in progress label Dec 8, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants