Reputation: 1050
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?
Upvotes: 1
Views: 808
Reputation: 9793
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
Upvotes: 1