0
이용 가능한 모든 무선 랜에 대한 세부 정보를 얻으려고 시도하지만, 검색 결과에 대해 BroadcastReceiver
은 호출되지 않습니다.이용 가능한 모든 무선 인터넷을 얻으십시오.
코드
활동
wifiStatusActivity extends AppCompatActivity {
WifiManager wifi;
List<ScanResult> results;
/* Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
wifi = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if (wifi.isWifiEnabled() == false) {
Toast.makeText(getApplicationContext(), "wifi is disabled..making it enabled",
Toast.LENGTH_LONG).show();
wifi.setWifiEnabled(true);
}
wifi.startScan();
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context c, Intent intent) {
log.i("LOG","Scan Complete");
}
}, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
}
매니페스트
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
어떤 제안 ...!