/**
* Auto settings in the driver. The driver could choose to operate on both
* 2.4 GHz and 5 GHz or make a dynamic decision on selecting the band.
* @hide
*/
public static final int WIFI_FREQUENCY_BAND_AUTO = 0;
/**
* Operation on 5 GHz alone
* @hide
*/
public static final int WIFI_FREQUENCY_BAND_5GHZ = 1;
/**
* Operation on 2.4 GHz alone
* @hide
*/
public static final int WIFI_FREQUENCY_BAND_2GHZ = 2;
使用WifiManager.java的常量部分,設置所需的頻段。 我們可以用API setFrequencyBand(int mode,boolean persist)設置頻率。 這些是隱藏的API。
代碼片段:
WifiManager wm = (WifiManager)getSystemService(Context.WIFI_SERVICE);
// To scan only 2.4 GHz Frequency band
// true, if this needs to be remembered
wm.setFrequencyBand(2, false);
// Start scan.
wm.startScan();
// To get the frequency band used.
int band = wm.getFrequncyBand();
5 GHz的我得到以下2500 –