Search code examples
androidandroid-virtual-device

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

  • On any recent build of the Android emulator (which contains this commit from 2018), there is a feature flag which can be set to allow for custom SSIDs to be added via the telnet console. To enable it, open lib/advancedFeatures.ini in the emulator directory (the default full path for this on Linux installations is ~/Android/Sdk/emulator/lib/advancedFeatures.ini) and change:

    WifiConfigurable = off
    

    to

    WifiConfigurable = on
    

    Ensure that you have restarted the emulator after making this change.

    You can then connect to the emulator via telnet (as described here) and after authenticating, the following wifi commands will be available:

    wifi
    allows you to manage wifi settings in the device
    
    available sub-commands:
        add              add new WiFi SSID
        block            block network access on SSID
        unblock          unblock network access on SSID