2

In IOS we have implemented using Reachability framework which provided by apple, In Android We need to find whether active internet connection is available are not. Actually We need find whether Wi-fi connected with active internet connection or not, We have tried lot of ways but we need to deduct instantly. In this case we should find out host reachability status of internet connection. We have tried this below link .

It was taken some time for the response, But we need to get instant response to finish the requirement. We need to solve the case, device connected with Wi-Fi but doesn't have internet connection. If anyone know the solution help us. Thanks in advance.

Community
  • 1
  • 1
Ramkumar Paulraj
  • 1,841
  • 2
  • 20
  • 40
  • After a quick read of the Reachability framework, I don't think it solves your problem either. Reachability suggests that you *might* be able to reach a particular host because the right network connections are available. The only way to be sure is to try a connection, and if it fails, try again. Consider the fact that even if a PING succeeds, a connection would still fail if the server had died between the PING and a CONNECT ! – Neil Apr 27 '17 at 09:11
  • From a requirements point of view, who has decided that you must do it 'instantly'? In your requirements document, is 'instantly' specified in milliseconds, or seconds? even if it took 5 minutes to connect, that is an instant in geological terms :-) – Neil Apr 27 '17 at 09:13
  • within 1 to 5 seconds we need to find out in this case – Ramkumar Paulraj Apr 27 '17 at 11:28

1 Answers1

1

In Android, you can subscribe to get a notification when it WiFi has connected. This is as instant as you are going to get.

ConnectivityManager will also allow you to poll to see if WiFi is available, but it's much better (and more battery friendly) to get an event.

See here for details

Neil
  • 11,059
  • 3
  • 31
  • 56
  • Actually We have detected whether connection is available or not, We need the host reachability status, We need to find In case WiFi connected but it doesn't have an internet – Ramkumar Paulraj Apr 27 '17 at 08:50