rx java - Prefetching network data with RxJava/Android -
i creating android events app uses rxjava wrap old network layer , cache setup observable.create(). i'm stumped how approach prefetching data though. display list of events open eventdetail activity fetch contents of given event. want prefetch of events' contents, end making redundant network calls if event selected before prefetch returns , caches. there way keep observables/subscriptions alive on activity switches? singleton network layer held in application? appreciated.
typically, keep logic away activities
, so, "yes, definitely!": network layer need.
keeping approach, subscriptions
stay alive if activity
restarted, instance, on rotation. useful operator need .cache()
, reuse ongoing network request instead of firing new 1 on new subscribe()
.
Comments
Post a Comment