Android WIFI热点默认SSID的修改方法

修改文件:

frameworks/base/wifi/java/android/net/wifi/WifiApConfigStore.java


相关代码片段:

private void setDefaultApConfiguration() {
    WifiConfiguration config = new WifiConfiguration();
    config.SSID = mContext.getString(R.string.wifi_tether_configure_ssid_default);
    config.allowedKeyManagement.set(KeyMgmt.WPA2_PSK);
    String randomUUID = UUID.randomUUID().toString();
    //first 12 chars from xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
    config.preSharedKey = randomUUID.substring(0, 8) + randomUUID.substring(9,13);
    sendMessage(WifiStateMachine.CMD_SET_AP_CONFIG, config);
}

修改位置:

config.SSID即为WIFI热点默认SSID,修改此处即可。

备注:

Android4.0之前的版本是在WifiService.java

你可能感兴趣的:(Android WIFI热点默认SSID的修改方法)