An UnknownHostException
is thrown if a server is down or if there is no internet connection. How can I determine if the UnknownHostException
is thrown because the server is down or there is no internet connection?
The reason for this is I need to notify the user about the cause of the error. And I have to display something like this "Sorry. The service is currently not available. Please try again later" or "You do not have an internet connection".