Need to use ScanResult class in service
Have some problem to use android.net.wifi开发者_JAVA百科.ScanResult class in my own service. In fact i have noticed that CREATOR in my class is missing, but in android doc (http://www.kiwidoc.com/java/l/x/android/android/8/p/android.net.wifi/c/ScanResult) CREATOR is present, i have tried with all versions of SDK and i lose hope... : (
Anyone can help me ?
Thanks,
Anthony.
The ScanResult class does not have a public constructor. It is intended to be returned from a scan of available WiFi connections, for example:
WifiManager wifiMgr = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
if(wifiMgr.isWifiEnabled()) {
List<ScanResult> scanResults = wifiMgr.getScanResults();
for(ScanResult scanRes : scanResults) {
// Do something with scanRes
}
}
Refer to the official Android documentation for ScanResult at: http://developer.android.com/reference/android/net/wifi/ScanResult.html
精彩评论