Is there any way to get notified when known SSIS wifi networks get in/out of range?

南楼画角 提交于 2019-11-30 13:15:48

问题


I want to write an application which consists on perform actions when a known wifi networks get in or out of range.

For example, let's say my home wifi network's SSIS is "WifiHome", and i want to make a notification "You just left home!" whenever the device can't detect this specific network anymore. (Or alternativly - "You just entered home" when the device re-detect signals from this network).

My question is: Is is possible to listen to those changes without polling the available-network-list frequently?


回答1:


You should listen to broadcast event SCAN_RESULTS_AVAILABLE_ACTION. This will be sent each time Wi-Fi scan is finished. When such event occurs just re-iterate the scan results that can be obtained via WifiManager's getScanResults.

When wi-fi is active, you'll receive this broadcast every several seconds. But there is no way to configure this interval and my guess is that each manufacturer may change this interval.

You can manually trigger wi-fi scan using WifiManager's startScan.



来源:https://stackoverflow.com/questions/5983214/is-there-any-way-to-get-notified-when-known-ssis-wifi-networks-get-in-out-of-ran

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!