'okhttp3 onFailure detection
I entered Okhttp (okhttp3) to retrieve data from the server. If the process of retrieving information from the server ends with "onFailure", I want to clarify why the process ends with "onFailure". How can I find out if the domain is disconnected from the server (the server is down‚ the domain is without a server) or the user's Internet is on? How can I do this on onFailure instead of checking the internet before starting okhttp3 and then starting the okhttp3 process? I want to issue a corresponding Toast message accordingly.
onFailure:
client.newCall(request).enqueue(new Callback () {
@Override
public void onFailure (Call call, IOException e) {
e.printStackTrace ();
}
how to:
- The internet doesn't work
- Domain problem
- other... Can I diagnose problems in onFailure and show a corresponding dialog?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
