This PR fixes a crash caused by the LostApiClient being unexpectedly disconnected. It updates the MapzenLocationImpl to unregister the listener it registers when stopLocationUpdates() is called instead of disconnecting the client. This behavior is more symmetrical to startLocationUpdates().
Proposed Changes
When the app launches both the SDK and EM create and connect LostApiClients. The first time a route starts, the SDK's client is disconnected when the "find me" button is hidden (this is expected), EM's client remains connected, and location updates are registered for (also expected). When the user backs out of a route, location updates are stopped and EM's client is disconnected (unexpected) but the underlying service remains connected because the SDK's client is connected. Then, the next time a route is started, onClickStartNavigation checks that the client is connected (it is because the SDK's client is). Then, before location updates are registered for, the "find me" button is hidden and because no other clients are connected, the service is disconnected. This PR prevents the LostApiClient connection state from being modified after it is checked by keeping EM's client connected.
Overview
This PR fixes a crash caused by the
LostApiClient
being unexpectedly disconnected. It updates theMapzenLocationImpl
to unregister the listener it registers whenstopLocationUpdates()
is called instead of disconnecting the client. This behavior is more symmetrical tostartLocationUpdates()
.Proposed Changes
When the app launches both the SDK and EM create and connect
LostApiClient
s. The first time a route starts, the SDK's client is disconnected when the "find me" button is hidden (this is expected), EM's client remains connected, and location updates are registered for (also expected). When the user backs out of a route, location updates are stopped and EM's client is disconnected (unexpected) but the underlying service remains connected because the SDK's client is connected. Then, the next time a route is started,onClickStartNavigation
checks that the client is connected (it is because the SDK's client is). Then, before location updates are registered for, the "find me" button is hidden and because no other clients are connected, the service is disconnected. This PR prevents theLostApiClient
connection state from being modified after it is checked by keeping EM's client connected.Closes #740