0

how to check wifi connection throught the entire application.is there any events or class that we can get message for that? thankx

Yaqub Ahmad
  • 27,569
  • 23
  • 102
  • 149
Hitendra
  • 3,218
  • 7
  • 45
  • 74

3 Answers3

1

See this question for details of how to check wifi status.

Do be aware that even if the wifi is switched on, and connected to a wifi network, that doesn't guarantee data can be transmitted and received - the signal may be too weak for example at the moment you try to use it. So don't assume connections will definitely work because the wifi is connected.

Community
  • 1
  • 1
Ollie C
  • 28,313
  • 34
  • 134
  • 217
  • Or you could be connectected to a network at full signal strength but the network is not connected to the internet, rare but it does happen. – FoamyGuy Feb 16 '11 at 16:24
  • Good point Tim. Hitendra, the thing to realise with mobile applications is the environment can change very often, so you need lots of error handling, and your app needs to cater to all the scenarios it may face, wifi absent, wifi connected, wifi connected but not connecting, wifi in the process of reconnecting, etc. – Ollie C Feb 16 '11 at 18:05
0

Take a look at WifiManager class.

Also here is a nice article with code samples.

Lucas S.
  • 13,391
  • 8
  • 46
  • 46
0

I use a super class that I extend all Activity classes from. It shows an alert when connectivity is lost and stays that way until connectivity is restored. You can edit it to add anything you want.

I have it at : https://github.com/sfarooq/A-droid-lib

Saad Farooq
  • 13,172
  • 10
  • 68
  • 94