问题
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