Android - 如何知道操作系统何时检测到附近的WiFi路由器? [英] Android - How to know when the OS detects nearby WiFi routers?
问题描述
我会简短地讲述故事,如果没有这些,你将无法做到使用您自己的wifimanager.startscan()实现 - 为了扫描WiFi AP,在解决方案中您需要使用意图过滤器WifiManager.SCAN_RESULTS_AVAILABLE_ACTION。
在这种方法中,您将能够通过使用getScanResults()方法获得所有WiFi AP列表的广播。为了重复做它,请考虑使用处理程序或线程。
Android OS periodically scans for available WiFi routers. Is there a way to get notified when this happens? I was searching for a BroadcastReceiver trigger but could not find any. Network state change doesn't work for this scenario. I'm trying to retrieve user's location using WiFi routers in indoor locations. Any idea how this could be done?
I'll make the story short, You will not be able to do it without using your own implementation of wifimanager.startscan() - in order to scan WiFi AP, in the solution you need to use the intent filter WifiManager.SCAN_RESULTS_AVAILABLE_ACTION. In this approach you will be able to get a broadcast with a list of all WiFi AP by using getScanResults() method. in order to do it repeatedly please consider to use handler or thread.
这篇关于Android - 如何知道操作系统何时检测到附近的WiFi路由器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!