Ok, I just got back to this.  After a clean install 'wipe' the same
behavior occurs.  In the emulator, I always have a network connection so
there's no reason to check if one is available.  However, in production
that is exactly what we'd do.  

The only thing consistent is it is constantly inconsistent.  
 

-----Original Message-----
From: monodroid-boun...@lists.ximian.com
[mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Jonathan Pryor
Sent: Friday, August 05, 2011 12:03 PM
To: Discussions related to Mono for Android
Subject: Re: [mono-android] HTTP issues

On Aug 5, 2011, at 11:31 AM, Tim Kelly wrote:
> However, during on C# testing, this attached routine is called every
minute and after a short period of time it causes the networking in the
emulator to stop requiring a reboot. 
>  
> We've determined nothing from the logs other than it  seems the DNS
request dies as a reported error first and then additional request just
timeout.  But basically it is all over the place and not consistent.

When that happens, before you reboot the emulator, try opening the
Browser app and seeing if you can navigate to a URL. Is it a system wide
loss of DNS/etc., or is it local to your app?

What I've noticed in testing with the emulator is that frequently when
the emulator boots it has no networking, and Browser won't be able to
load anything (which breaks my test app, which also tries a network
request w/o any graceful error catching). Restarting the emulator fixes
this problem (as I haven't explored enough to figure out why the
emulator is coming up w/o networking in the first place).

This may or may not be related to the issues you're seeing; I have no
idea. It does bring up a major point, though: you can't expect to have
"always accessible" networking on the device, so you should try checking
the network connection status before you fire off your network requests
(adapted from
http://www.androidpeople.com/android-how-check-network-statusboth-wifi-a
nd-mobile-3g):

        static bool IsNetworkAvailable (Context context)
        {
                // requires the android.permission.ACCESS_NETWORK_STATE
permission
                var manager = (Android.Net.ConnectivityManager)
context.GetSystemService(Context.ConnectivityService);
                var wifi = manager.GetNeworkInfo
(Android.Net.ConnectivityType.Wifi);
                var mobile = manager.GetNetworkInfo
(Android.Net.ConnectivityType.Mobile);
                bool online = wifi.IsAvailable || mobile.IsAvailable;
                return online;
        }

This may help your app, it may not; it's my current best guess. :-)

 - Jon

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to