I just push the buttons….

Android Emulator ConnectivityManager, always returning connected

leave a comment »

I have recently be playing around with the ConnectivityManager in the android emulator. I was trying to detect if the emulator had internet connectivity or not.

ConnectivityManager connec =  (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);

connec.getNetworkInfo(0).getState() // = CONNECTED
connec.getNetworkInfo(1).getState() // = CONNECTED

Every time I retrieved the status from the NetworkInfo it would return “CONNECTED”, even when I disconnected from internet.

After doing some hunting around on the issue, I found that you need to manually disable the internet connectivity on the emulator. The emulator does not listen to the computers  network interface so disable the network / internet will not effect the emulator.

To disable internet / network connectivity on the emulator hit F8.


Written by tomkaurin

October 29, 2010 at 6:46 pm

Posted in Android, Emulator

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: