Search code examples
androidadb

how do I change the network state over ADB?


I have an emulator that I want to simulate the loss of a data connection while in my app. I have the receiver's setup correctly but I need a way to change the data connection via adb.

Is there an ADB command that turns off the data connection?


Solution

  • You can connect to an emulator via telnet

    telnet localhost 5554
    

    once connected you can set the network speed.

    network speed 0
    

    or

    gsm data off 
    

    maybe you find this link helpful.

    https://developer.android.com/studio/run/emulator-console#querycontrol