新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
通过调用WifiManager类: IntentFilter filter = new IntentFilter(); filter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); final WifiManager wifiManager = (WifiManager)getApplicationContext().getSystemService(Context.WIFI_SERVICE);; registerReceiver(new BroadcastReceiver(){ @SuppressLint("UseValueOf") @Override public void onReceive(Context context, Intent intent) { sb = new StringBuilder(); scanList = wifiManager.getScanResults(); sb.append("\n Number Of Wifi connections :" + " " +scanList.size()+"\n\n"); for(int i = 0; i < scanList.size(); i++){ sb.append(new Integer(i+1).toString() + ". "); sb.append((scanList.get(i)).toString()); sb.append("\n\n"); } }