Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing in "Airplane" mode in Android Emulator

I'm trying to test my application for situations when the phone has no connection to the internet.

In my emulator, I turned on Airplane Mode in the settings. However, my app still seemed to be able to communicate with my server. It works as normal.

On my device, the same code throws an error with no data connection.

How can I ensure that there is no internet connection in the emulator so I can use LogCat etc to analyze the code.

like image 902
Arjun Avatar asked Nov 20 '11 02:11

Arjun


2 Answers

You can switch off Internet access by pressing F8 in the emulator

like image 185
EyalBellisha Avatar answered Sep 19 '22 14:09

EyalBellisha


In emulator the airplane mode option doesn't works well. so, try pressing F8 function key to stop the internet access to the emulator and check your app in offline. The airplane mode is closely related the communication signal which has effect only in device but not in emulator. Anyhow when airplane mode is turned on, automatically the internet access should be stopped, which happening in device but not in emulator. Don't worry about that you have an alternative to stop net access by pressing F8.

Then check for network availability through code, enjoy !!

like image 26
java dev Avatar answered Sep 21 '22 14:09

java dev