[mono-android] Check for internet connection fails on Vodafone 858

Petr Slováček pslovacek at newlink.cz
Mon Jun 25 14:00:04 UTC 2012


Well.... I answer it myself... :-)

This one works on Vodafone 858 also:

ConnectivityManager conMgr = (ConnectivityManager)context.GetSystemService (Context.ConnectivityService);
return conMgr.ActiveNetworkInfo != null
                        && conMgr.ActiveNetworkInfo.IsAvailable && conMgr
                              .ActiveNetworkInfo.IsConnectedOrConnecting;

Petr


From: monodroid-bounces at lists.ximian.com [mailto:monodroid-bounces at lists.ximian.com] On Behalf Of Petr Slovácek
Sent: 25. června 2012 15:11
To: monodroid at lists.ximian.com
Subject: [mono-android] Check for internet connection fails on Vodafone 858

Hello everyone,

I'm using this piece of code to check if internet connection is available:

ConnectivityManager conMgr = (ConnectivityManager)context.GetSystemService (Context.ConnectivityService);
bool output = conMgr.ActiveNetworkInfo != null
                        && conMgr.ActiveNetworkInfo.IsAvailable && conMgr
                              .ActiveNetworkInfo.IsConnected;
conMgr.Dispose ();
return output;

It works fine on all my test devices except Vodafone 858 (Huawei). On this device I get false even when there's an Edge/3G or WiFi connection available. Any ideas why it behaves like this?

Petr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20120625/cdff55d7/attachment.html>


More information about the Monodroid mailing list