tags:

views:

29

answers:

1

Hi,

I am making an application that fetches data from internet like web service,so it requires internet connection.

So when i first click on my application, If internet connection is not available it should show me dialog that Internet connection not available get it connected.And if connection is available then it should be able to work fetch data from internet.

Can anybody guide me how to check if internet connection is available or not?

+1  A: 

Simply making a request for something like google.com would let you know that you have an internet connection. The first thing you need to make sure that you have done is to request internet access via your manifest. See these two pages:
http://developer.android.com/guide/topics/security/security.html
http://developer.android.com/reference/android/Manifest.permission.html#INTERNET

Mondain
i have set permission ...Do i need to use ConnectivityManager?
Rakesh Gondaliya
Have a look at the answer to this similar question: http://stackoverflow.com/questions/1560788/how-to-check-internet-access-on-android-inetaddress-never-timeouts
Mondain
thanks for ur time, completed my task..thanks
Rakesh Gondaliya