Search code examples
androidrobospice

Robospice: return cached data when network is down


I am starting to use robospice for an application which has to function in regions with changing connectivity.

How would I achieve that robospice would automatically return the cached data when the network is down?

Thanks Ben


Solution

  • I have not worked with Robospice at all. But from what I can tell it looks like the request class allows you to specify AcceptingDirtyCache by calling

       request.setAcceptingDirtyCache(boolean isAcceptingDirtyCache) 
    

    there was a thread about this on github that talks about this very problem.

    Also not sure since I have never used robospice but you should be able to call CacheManager.loadDataFromCache() to load any data that exists in the cache. So you could utilize this function whenever you need to make a request but the network is down.