갤럭시S3 에서는 되는데 갤럭시A8에서는 와이파이 검색이 안됩니다.
최신 폰에서 안되는 듯 합니다.
이유가 뭘까요?
//wifi Scan...
private BroadcastReceiver ScanReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (action.equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) {
getWIFIScanResult(); // get WIFISCanResult
wifiManager.startScan(); // for refresh
} else if (action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
sendBroadcast(new Intent("wifi.ON_NETWORK_STATE_CHANGED"));
}
}
};
public void getWIFIScanResult() {
String[] spl;
String str;
mScanResult = wifiManager.getScanResults(); // ScanResult
showmsg(""+mScanResult+"개의 와이파이가 검색되었습니다.");
// Scan count
for (int i = 0; i < mScanResult.size(); i++) {
ScanResult result = mScanResult.get(i);
if(result.SSID.length()>4) {
list.add(result.SSID.toString() + ",\t\t 신호세기:" + result.level + " dBm");
str = result.SSID.toString();
spl = str.split("-"); //문자열 분리
if (spl.length > 0) {
}
}
}
adapter.notifyDataSetChanged(); //ListView 화면 갱신.
SearchBtn.setText("검색완료");
getApplicationContext().unregisterReceiver(ScanReceiver); // stop WIFISCan
playSystemBeep();
}
public void initWIFIScan() {
// init WIFISCAN
final IntentFilter filter = new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
getApplicationContext().registerReceiver(ScanReceiver, filter);
wifiManager.startScan();
SearchBtn.setText("검색중..");
}