Status Update
Comments
pu...@gmail.com <pu...@gmail.com> #2
[Comment deleted]
wa...@gmail.com <wa...@gmail.com> #3
me too. The reason is my locate setting is off.
ke...@telecomnancy.net <ke...@telecomnancy.net> #4
I have the same issue and I thought that my piece of code were wrong. It seems that this is a common mistake. Do you know how to solve it ?
mr...@gmail.com <mr...@gmail.com> #5
Ask user to enable the location settings and try to scan it.
yu...@gmail.com <yu...@gmail.com> #6
The development team has fixed the issue that you have reported and it will be available in a future build.
sa...@gmail.com <sa...@gmail.com> #7
If scanned results can expose user location, At least give us an interface that can provide basic information about the network such as name and a way to connect them. Even if we one can't scan for available networks, he can still connect to a particular known network by adding the known network configurations (wifiManager.addNetwork(conf)). So, at least, you can only give a boolean value determining the presence of known network devices.
[Deleted User] <[Deleted User]> #8
WifiManager#getScanResults() returns null if GPS is turned off.
- Steps to reproduce the problem (including sample code if appropriate).
1. Use Nexus 5 (or 6) with M preview 3.
2. Turn on Wi-Fi of the smartphone.
3. Turn off GPS of the smartphone.
4. Prepare some APs around the smartphone, and activate them.
- What happened.
WifiManager#getScanResults() returns an empty array list.
(Wi-Fi setting of "Settings" also shows no APs and says "Searching for Wi-Fi networks...".)
- What you think the correct behavior should be.
WifiManager#getScanResults() returns a valid array list of currently found APs.
- Device and OS
Nexus 5, 6 with M preview 3
- Steps to reproduce the problem (including sample code if appropriate).
1. Use Nexus 5 (or 6) with M preview 3.
2. Turn on Wi-Fi of the smartphone.
3. Turn off GPS of the smartphone.
4. Prepare some APs around the smartphone, and activate them.
- What happened.
WifiManager#getScanResults() returns an empty array list.
(Wi-Fi setting of "Settings" also shows no APs and says "Searching for Wi-Fi networks...".)
- What you think the correct behavior should be.
WifiManager#getScanResults() returns a valid array list of currently found APs.
- Device and OS
Nexus 5, 6 with M preview 3
ah...@gmail.com <ah...@gmail.com> #9
I had confirmed the same with Nexus 5 Preview 3 (build num.: MPA44G).
ra...@gmail.com <ra...@gmail.com> #10
From
on 07/04/2022: issue 37060483
thanks for your team
an...@gmail.com <an...@gmail.com> #11
> From issue 37060483 on 8.09.2015 г.:
I've found this code fragment in the newest API 23 SDK's source code
WifiServiceImpl.java Line964
if (!canReadPeerMacAddresses && !isActiveNetworkScorer && !isLocationEnabled()) {
return new ArrayList<ScanResult>();
}
It could explain this issue.The method "isLocationEnabled" read Location settings then returns false at this condition, and getScanResults returns null.
I've found this code fragment in the newest API 23 SDK's source code
WifiServiceImpl.java Line964
if (!canReadPeerMacAddresses && !isActiveNetworkScorer && !isLocationEnabled()) {
return new ArrayList<ScanResult>();
}
It could explain this issue.The method "isLocationEnabled" read Location settings then returns false at this condition, and getScanResults returns null.
Description
Android version: 6.0
After updating to 6.0, my app cannot get WiFi scan results any more, the same code is working on device with older version.
I've aware of Android 6.0 changes here
The app has already granted ACCESS_COARSE_LOCATION permission previously, so this change should not be related.
sample code (partly):
1.Register receiver
IntentFilter filter = new IntentFilter();
filter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
mContext.registerReceiver(mWiFiReceiver, filter);
2.Request a scan
mWifiManager.startScan();
3.Get scan results
private BroadcastReceiver mWiFiReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
List<ScanResult> result = mWifiManager.getScanResults();
...
}
Here I'm always getting an empty list of ScanResult.
Please help to check is there anything I'm doing wrong.