Directions API requests should be canceled when NavigationActivity is destroyed
It's good practice to cancel any calls that Retrofits making if the activity gets destroyed. We can make use of the Lifecycle component
to automatically cancel the event.
@zugaldia @danesfeder
Architecture components and Retrofit is explicitly mentioned on the official docs: https://developer.android.com/topic/libraries/architecture/guide.html#fetching_data
@danesfeder, I remember a few weeks ago you asked about canceling the request? Did this issue get worked out?
@cammace I didn't have a chance to add this to NavigationRoute but should be a quick PR to expose that API
@cammace @danesfeder Assuming you are talking about having NavigationRoute implement LifecycleObserver, how were you invisioning setting it up with a LifecycleOwner? Passing the LifecycleOwner to the NavigationRoute, or manually setting it everywhere NavigationRoute is used? It's a little complicated in the case of RouteEngine because NavigationRoute is a couple steps removed from any LifecycleOwners.
@danesfeder & @akitchen were discussing -- it would also be good to provide developers with a way to cancel outstanding requests from NavigationRoute