WiFi Scan return result as zero, It's not working in Marshmallow Android 6.0.1
Bhavdip opened this issue · 1 comments
I try the demo example. I run it in MarshMallow Android version 6.0.1 it asked for the location permission that would adequate. But after allowing the permission granted still the list return result size is 0. After debugging found that inside this method observeWifiAccessPoints the start scan work perfect but wifiManager.getScanResults() return the scan results in zero.
final BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
wifiManager.startScan(); // we need to start scan again to get fresh results ASAP
subscriber.onNext(wifiManager.getScanResults());
}
};
After spedning lots of time found that it's bug after android version 6. The WifiManager#getScanResults() returns an empty array list if GPS is turned off. Only permission granted would not work.
So I post this issue to inform to other people who using this lib and suppose to not get the list then they need to turn on the GPS to getting start to scan the wifi. Only Allowing location permission would not work.
Thanks