1. 程式人生 > >關於wifi 2.4G和5G的闡述

關於wifi 2.4G和5G的闡述

  1. 2400-2527Mhz 是所謂的2.450 GHz頻段(即我們所說的2.4GHZ);具體方位可以自行檢視,這個範圍比國內使用的大
  2. 5.725–5.875 GHz 就是所謂的5.800 GHz頻段(即我們所說的5GHZ),都說比2.4G快三倍,但是距離遠,頻率高了,波長就短了,導致能量不夠,所以傳播距離短,只有採用802.11ac協議的Wi-Fi才是真正5G Wi-Fi哦
  3. 注意:這裡指的是wifi的頻率,而不是手機頻寬(2G,3G,4G,5G),頻率只和路由器有關,目前老的路由器是2.4g,新的有雙開功能,既有2.4g,也有5gWiFi
  4. 附上Android程式碼:
/**
 *獲取當前連線的WiFi頻率
 */
private WifiManager wifiManager; private int getCurrentWifiFrequency() { int frequency = -1; if (wifiManager == null) { wifiManager = ((WifiManager) mContext.getSystemService(Context.WIFI_SERVICE)); } WifiInfo wifiInfo = wifiManager.getConnectionInfo(); if
(Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {//Android 5.1之上 frequency = wifiInfo.getFrequency(); } else { String wifiSsid; String tempSsidString = wifiInfo.getSSID(); if (tempSsidString != null && tempSsidString.length() > 2
) { wifiSsid = tempSsidString.substring(1, tempSsidString.length() - 1); List<ScanResult> scanResults = wifiManager.getScanResults(); for (ScanResult scanResult : scanResults) { if (scanResult.SSID.equals(wifiSsid)) { frequency = scanResult.frequency; break; } } } } return frequency; }

/**
 *判斷是否是5gwifi,5gwifi頻率大,波長短,能量低,傳遞距離遠
 */
    private boolean is5GWifi(int frequency) {
        boolean result = false;
        LogUtils.i(WifiConfigView.class, "frequency is " + frequency);
        if (frequency > 2400 && frequency < 2527) {
            result = false;
        } else {
            result = true;
        }
        return result;
    }

參考:論壇帖子