'Changing the Wifi name for a Virtual Android Device

The Android Virtual Device is connected by defualt to a wifi network called "AndroidWifi". I am working with an app that expects to be connected to a wifi network with a particular name.

How can I change the name of the wifi network from "AndroidWifi"?



Solution 1:[1]

Try something more pragmatic:

String getExpectedId() {
    String ssid = this.getResources().getString(R.string.default_ssid);
    if(Build.FINGERPRINT.contains("generic")) {ssid = "AndroidWifi";}
    return ssid;
}

because you won't change the SSID (service set identifier) of the emulator's WiFi.


Despite there's adb commands alike svc wifi enable and svc wifi disable, the password for the default network likely is unknown in /data/misc/wifi/wpa_supplicant.conf; see Connecting to WiFi using adb shell. Since the emulator is rooted, one can generally configure any network alike that, while it is accessible (which the regular WiFi, which is exists in reality, obviously isn't). I think the first one approach is better, because editing emulator images isn't too portable.

Solution 2:[2]

AVD manager doesn't provide any ways to customize the simulated Wi-Fi access point AndroidWifi .

You may have to disable it and use another wifi simulator such as this one. It does need the Xposed framework in order to function. Here is how you can configure it.

Solution 3:[3]

You can modify the hostapd.conf file in your device (/data/vendor/wifi/hostapd/hostapd.conf). It will allow you to set ssid (ssid=) or even to set a password (wpa_passphrase). You will need a root access to do that.

More details at https://wiki.gentoo.org/wiki/Hostapd#WiFi_Technology

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Bertram Gilfoyle
Solution 3 mast313