昨天,我的Nexus 5收到了更新Android MNC到的版本6.0 - Marshmallow。从那时起,扫描设备中可用网络的操作将停止接收列表,在这种情况下,即使Wifi系统设置中列出了10个以上的Wifi网络,结果列表的大小也为0。
这是通常的代码:SCAN_RESULTS_AVAILABLE_ACTION在Receiver中注册并等待事件,如下所示:
// Register the Receiver in some part os fragment...
getActivity().registerReceiver(wifiListener, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
wifiManager.startScan();
// Inside the receiver:
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
List<ScanResult> results = wifiManager.getScanResults();
// the result.size() is 0 after update to Android v6.0, same code working in older devices.
我搜索了有关此主题的API主题的更改,但没有看到此功能的任何重大更改。
有人注意到吗?API中有新内容还是仅是个别情况?
心有法竹
拉风的咖菲猫
胡子哥哥
相关分类