開發過程中出現了通過自定義設置打開熱點後手機搜索不到熱點的問題。 後來通過觀看 /data/misc/wifi 目錄下的 hostapd.conf 文件,發現是 ...
開發過程中出現了通過自定義設置打開熱點後手機搜索不到熱點的問題。
後來通過觀看 /data/misc/wifi 目錄下的 hostapd.conf 文件,發現是
interface=ap0 driver=nl80211 ctrl_interface=/data/misc/wifi/hostapd ssid=Anffff channel=6 ieee80211n=1 hw_mode=g ignore_broadcast_ssid=1 wowlan_triggers=any max_num_sta=6 eap_server=1 wps_state=2 config_methods=display physical_display push_button device_name=AndroidAP manufacturer=Media******** model_name=************* model_number=66xx serial_number=1.0 device_type=10-00******* wpa=2 rsn_pairwise=CCMP wpa_psk=17aa1678a8ae7317122e429ca3****************
ignore_broadcast_ssid=1引起的,其值要是0,才能被手機搜索到。
後來繼續查找,發現是在WifiConfiguration config = new WifiConfiguration();
的new過程中將config.hiddenSSID賦值為了true引起的,最後我將config.hiddenSSID其值修改為了false之後,手機就可以正常搜索到這個熱點了。