Yesterday my Nexus 5 receive the update from Android MNC
to version 6.0 - Marshmallow
.
Since then, the action to scan the networks available in the device stop receiving the list, in this case the result list have a size of 0, even with 10+ Wifi networks listed in the Wifi system settings.
The code for this is the usual: Register the SCAN_RESULTS_AVAILABLE_ACTION
and wait for the event in the Receiver, like this:
// 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.
I searched in the changes of the API topic about this, but I didn' see any breaking changes for this functionality.
Did anyone notice this? Is something new in the API or just a isolated case?
Wifi > Advanced
I just seeNetwork Notification
andKeep Wifi...
options, the Scanning options that appears between these two seems to be gone in this version. – RodrigueswifiListener
? I tried all the code provided, but I'm still getting empty list for Android 6.0 (works fine for < 6.0). – Biennial