Here is my request look like
Single<Response<ResponseBody>> fetchRawData()
and the http cache is enabled.
When internet connection is off and first time when I go to this fragment I receive UnknowHostException and
when I check with flipper it doesn't show status code in this case.
and then I kill app, and then open again ,
this time I receive
Response{protocol=http/1.1, code=503, message=, url=}
I don't understand what makes this difference.
Asked
Active
Viewed 835 times
3

Artur A
- 257
- 3
- 20
-
5xx response code is server side only. look at your callback methods and search for problem there. – kAvEh Apr 26 '20 at 06:20
-
What do you mean callback ?what callbacks are talking? – Artur A Apr 26 '20 at 19:22
2 Answers
0
You need to check in your API handler class as if the internet is off and this status is coming then there is chance that it is coming from your code only try searching this status code in your code and you will get identified from where it is coming.
Also, Best Practice is like if the internet is not there API call should not get executed.

Mohit Dholakia
- 252
- 2
- 16
-
I don't want to check internet connection , as it can be that the connection is off but as I am using http cache it means I could not get cached data. and there are other reasons that I don't want to check connection state. – Artur A Apr 23 '20 at 22:41
-1
I think your problem is related to your dependencies. I have faced a similar issue in the recent past. In my case the problem's cause was dependencies. I upgraded many dependencies and the issue was solved mysteriously.
Also be cautious about the buildscript block inside project level build.gradle. There may be something missing in repositories or dependencies block.

oiyio
- 5,219
- 4
- 42
- 54
-
How it can connected to dependency, I am sure there is no dependency issue – Artur A Apr 27 '20 at 19:54