Try something like:
try{
URL page = new URL(address);
HttpURLConnection connection = (HttpURLConnection) page.openConnection();
connection.setConnectTimeout(2000);
connection.setReadTimeout(2000);
connection.connect();
}catch (SocketTimeoutException e1) {
} catch (ConnectTimeoutException e2) {
}catch (IOException e3) {
}
On Friday, August 17, 2012 10:17:52 PM UTC+4, Wolfgang wrote:
>
> Hey guys,
>
> My app relies greatly on updated data from my server. The app is up and
> running great. However, I realize servers can go down and I want my app to
> be able to handle this. I simply want to display a message saying the
> server is currently down and then gracefully close the app. Can anyone
> point me to a good resource to accomplish this or give me some guidance.
>
> Thanks,
>
> -W
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en