开发者

how to check wifi connection throught the entire application?

开发者 https://www.devze.com 2023-02-11 01:33 出处:网络
how to check wifi connection throught the entire application.is there any events or class that we can get message for that?

how to check wifi connection throught the entire application.is there any events or class that we can get message for that? th开发者_开发知识库ankx


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.


Take a look at WifiManager class.

Also here is a nice article with code samples.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号