Here is a great helper method by MisterSquonk to detect if your app has an internet connection or not.

Note that this method cannot be used to check if an external site you are trying to access is alive or not.

Related Posts Plugin for WordPress, Blogger...