开发者

Android WiFiManager.getScanResults() does not return hidden SSID data

开发者 https://www.devze.com 2023-04-12 17:15 出处:网络
I\'m working on an Android project to scan the local WiFi environment in our office. The short story is that we want to find access points that don\'t belong there.

I'm working on an Android project to scan the local WiFi environment in our office. The short story is that we want to find access points that don't belong there.

The problem: Android does not seem to return information regarding access points with hidden SSIDs. Does anyone know how t开发者_开发问答his is done? On other platforms a scan result set would typically contains all the usual data regarding an access point with a hidden SSID, minus (obviously) its SSID.

Does anyone know how this is done on Android?

My code looks like examples I've seen:

public class Scanner {  
    private WifiManager mainWifi;
    private WifiReceiver receiverWifi;
    // ...
    public Scanner(Context context){
        mainWifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
        receiverWifi = new WifiReceiver();
        context.registerReceiver(receiverWifi, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
        mainWifi.startScan();
    }
    // ...
    class WifiReceiver extends BroadcastReceiver {
        public void onReceive(Context c, Intent intent) {
            List<ScanResult> scanResultsList = mainWifi.getScanResults();
            // ...
        }
    }
}   

Thanks!


This is how android is built to work. No hidden SSID's get passed along to applications during the scans.

This is a bug that has been reported a long time ago and has never even been looked at.

http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&sqi=2&ved=0CC4QFjAB&url=http%3A%2F%2Fcode.google.com%2Fp%2Fandroid%2Fissues%2Fdetail%3Fid%3D10305&ei=mf8CT-rREOTf0QH94LS3Ag&usg=AFQjCNECvPs0QfS2MERv4jQmL7CYSsR95A&sig2=W0DAy5n32wzl0sAbo5E42g


seeing this web:

To connect to a hidden SSID, the phone must have WifiConfiguration.hiddenSSID set to true. Currently there does not seem to be a way to enable this through the phone UI, but there is a workaround thanks to stewart.wayne.scott. Note that "MySSID" should be the name of the Hidden SSID. Essentially you need to run the following code on your phone. At the moment there is no premade APK that does this, so it requires creating a program with the Android SDK, compiling it, and running it on the phone.

Then you must understand that could be difficult to do it ( i won't say imposible but nearly ) . Maybe with that info you can do something.

0

精彩评论

暂无评论...
验证码 换一张
取 消