Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to simulate total network loss in Android Emulator

I'm trying to write an application that needs to know when there is no IP network connection available. I am using the android.net.conn.CONNECTIVITY_CHANGE broadcast event along with ConnectivityManager to react to the changes in state to achieve this, but I'm having problems testing my set up in the emulator.

I have tried both flight mode and pressing F8 to disable the "Cellular Network" but even with both of these engaged the application still "sees" the underlying network.

Has anybody managed to find a way to simulate a total lack of network access?

like image 274
hardillb Avatar asked Nov 11 '10 13:11

hardillb


People also ask

How do you simulate slow Internet connection react native?

Go to the Network tab of your React Native debugger. You can simulate a network connection by clicking on the "No throttling" dropdown. You can choose among presets such as 2G or 3G, but you can also create your own preset based on your needs.


2 Answers

I have experienced that after pressing F8 an icon in the status bar shows that there's no connectivity, but if you try to browse it works. Maybe it has something to do with this opened bug: bug 3838

like image 128
Javi Avatar answered Sep 20 '22 20:09

Javi


There is DDMS Perspective in Eclipse, where you can manipulate with connection speed and availability (in the Emulator Control Tab). If it doesn't work for you, I may may suggest to turn on network of your OS or even plug off cable :)

like image 22
Anton Derevyanko Avatar answered Sep 22 '22 20:09

Anton Derevyanko