Hi,
Here's the code snippet to check if network is available:
Check the javadoc for ConnectivityManager........Class that answers
queries about the state of network connectivity
ConnectivityManager mgr = (ConnectivityManager)
context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = mgr.getActiveNetworkInfo();
if (netInfo != null)
Log.d(TAG, netInfo.isAvailable());
Apart from this, you probably have a connection timeout capability
within your jakarta API's (SOCKET_TIMEOUT underneath the hood), which
you can handle within your application.
Hope this helps,
Chander
On Jan 19, 12:18 am, petunio <[email protected]> wrote:
> Hi
>
> I am writing an application that involves downloading and uploading
> data over the net
>
> I am using the Jakarta library to do that, but my problem is how to
> know when the connection is down. Right now I am assuming that the
> connection is always ok, so when is not and I'm trying to download/
> uploading something, the programs hangs forever
>
> any ideas?
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---