okhttp Interceptors to intercept when internet is disabled

孤街浪徒 提交于 2019-12-11 18:09:38

问题


I am working on network module where it should provide offline data where I am fetching previously stored JSON response from local db and building response and returning to the application. All this is happening in my okhttp Interceptor at application level. I know I could have checked for n/w availability with ConnectivityManager

Every time I tried with n/w disabled or changing server false server URL for testing, Debugger just disappears call to chain.proceed(request)

Please note I knew I would have landed in onFaluire of retrofit in my app for any internet error. but I don't want that. Instead I want that to be handled inside interceptor and build response and return.

Searched on net found one question similar to this.

Let me know if any clarity needed on this.

来源:https://stackoverflow.com/questions/39525511/okhttp-interceptors-to-intercept-when-internet-is-disabled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!