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?
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.
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
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 :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With