- Home /
How to check Internet is Available or Not in Android?
Hi,
I tried to send the data only when internet connection available. I Connected to Local Network. But that's protected by firewall. So, I can't access Local Network Without Permission.
I used Application.internetReachablity to check internet connection.
If i connected to that Local Network. But, don't have permission. Clicking send will Check for internet Connection. (Application.internetReachability returns true). I can't able to connect the internet.
How could i Check that Internet connection Availability on this scenario.?
Even i saw these post didn't get the solution.
Help to solve this issue?
But in Windows Phone 8 : I use the following code to solve that issue,
if (DeviceNetworkInformation.IsNetworkAvailable && (DeviceNetworkInformation.IsWiFiEnabled || DeviceNetworkInformation.IsCellularDataEnabled))
{
//internet Available
}
else
{
//internet Not Available
}
Comment
Answer by tonic · Jul 05, 2014 at 06:33 AM
To truly know you're online, you need to implement "captive portal detection", to know if you're e.g. hitting a public WiFi login page. So just checking Application.internetReachability or doing a Ping to some address doesn't guarantee you can successfully make connections or make WWW requests.
I have made an easy asset called Internet Reachability Verifier. It keeps you up-to-date whether you have verified internet access (WWW requests can be done). More info here: http://j.mp/IRVUN