Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to show Data when Offline #54

Closed
HuuNguyen312 opened this issue Feb 22, 2017 · 5 comments
Closed

How to show Data when Offline #54

HuuNguyen312 opened this issue Feb 22, 2017 · 5 comments

Comments

@HuuNguyen312
Copy link

Hi

I see your project using Realm to cache. But when offline, I received the notice Data loading failure ヽ(≧Д≦)ノ

How to show Data when Offline
Thanks

@codeestX
Copy link
Owner

@ngochuu90
Hello, This application use OkHttp3 to cache network-data rather than Realm.
You can find it in RealmHelper.java.

builder.addNetworkInterceptor(cacheInterceptor);
builder.addInterceptor(cacheInterceptor);
builder.cache(cache);

Realm is used to cache reading records and so on.
BTW, Using RxCache to manage offline data is a better way.

@codeestX
Copy link
Owner

@ngochuu90 Sorry, RetrofitHelper.java, not RealmHelper.java.

@HuuNguyen312
Copy link
Author

I have found RetrofitHelper

builder.addNetworkInterceptor(cacheInterceptor);
builder.addInterceptor(cacheInterceptor);
builder.cache(cache);


When Online
screenshot_2017-02-22-15-37-54-776_com codeest geeknews

When Offline
screenshot_2017-02-22-15-38-06-472_com codeest geeknews

@codeestX
Copy link
Owner

@ngochuu90 I just had a test in an offline environment with my Nexus6P. And Zhihu,Gank,Wechat modules works well.
Gold module load failed. Perhaps because its API does not support Cache-Control in HTTP head.
V2EX module based on Jsoup rather than OkHttp, it will not work when offline.

@HuuNguyen312
Copy link
Author

Thanks for your reply. Your information is very helpful. Great Project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants