好吧,我有ScanResults,从那里我可以有SSID,BSSID,所有wifi的频率.
Well i have ScanResults and from there i can have SSID , BSSID , Frequency of all the wifi's.
List<ScanResult> results = wifi.getScanResults();我也有Connected wifi信息,所以从那里我也有已连接的SSID和已连接的wifi的BSSID.
Also i have the Connected wifi info so from there also i am having SSID of connected and BSSID of the connected wifi.
WifiManager wifi; WifiInfo info; wifi = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE); info = wifi.getConnectionInfo();现在,我只想拥有连接的wifi的频率,但是当我检查SSID和BSSID时,它们对于2个网络而言可以是相同的.现在如何找到连接的Wifi的频率.
Now i only want to have the frequency of the connected wifi but when i check SSID and BSSID they can be same for 2 network. Now how can i find the frequency of the connected Wifi.
我也想从那个wifi获得相应的频道号.
Also from that wifi i want to have corresponding channel no.
我找到了一张桌子
频道编号下限频率(GHZ)中心频率(GHZ)上限频率(GHZ)
CHANNEL NUMBER LOWER Freq(GHZ) CENTER Freq(GHZ) UPPER Freq(GHZ)
1 2401 2412 2423
1 2401 2412 2423
2 2404 2417 2428
2 2404 2417 2428
3 2411 2422 2433
3 2411 2422 2433
4 2416 2427 2438
4 2416 2427 2438
5 2421 2432 2443
5 2421 2432 2443
6 2426 2437 2448
6 2426 2437 2448
7 2431 2442 2453
7 2431 2442 2453
8 2436 2447 2458
8 2436 2447 2458
9 2441 2452 2463
9 2441 2452 2463
10 2451 2457 2468
10 2451 2457 2468
11 2451 2462 2473
11 2451 2462 2473
12 2456 2467 2478
12 2456 2467 2478
13 2461 2472 2483
13 2461 2472 2483
14 2473 2484 2495
14 2473 2484 2495
想知道sdk是否总是提供该表的中心频率,还有其他频率,例如5Ghz等?
Want to know whether sdk always provides center freq of this table and also what abt other freq like 5Ghz etc?
推荐答案WifiInfo的频率仅自Lollipop(API 21)开始可用. developer.android/reference/android/net/wifi/WifiInfo.html#getFrequency()
The frequency from WifiInfo is only available since Lollipop (API 21) developer.android/reference/android/net/wifi/WifiInfo.html#getFrequency()
android.wifi.WifiInfo public int getFrequency () Returns the current frequency in FREQUENCY_UNITS.更多推荐
Android wifi获取已连接Wifi的频率
发布评论