I suggest that you examine the code for DownloadProvider from the Android source tree. It properly handles just about every type of possible event the phone could encounter.
That said, in my experience EDGE and 3G can switch transparent to the application, however you will see a somewhat significant throughput delay during this transition. Switching to Wi-Fi will always shut down mobile data connections (EDGE/3G) and so you will see your connections disrupted immediately and are expected to now retry on the new network. Wi-Fi will shut off after so many minutes of the screen being off, which will then re-enable the mobile data connections and again your program should reconnect. One pitfall to watch out for is that the CPU may have fallen asleep on you in which case only data transmission from the peer you are connected to will wake it up. So if your connection fails and you schedule a timer to retry, you may find that the timer never triggers until after the user has turned the screen back on. To avoid this behaviour, you would either hold a WakeLock (think carefully about whether you need this, it is very expensive), or use an AlarmManager which is capable of waking the CPU. To answer your questions more directly: 1. No, you must handle network failure as if it were a common and likely occurrence. Mobile data connections are inherently very unreliable. 2. Yes, but you should hold a WifiLock for this purpose. Also, you would use the ConnectivityManager to determine whether the phone was on a Wi-Fi network or not. On Nov 15, 7:12 pm, trisk <[EMAIL PROTECTED]> wrote: > I'm currently writing an application that will be downloading > potentially large files from the net (50-100 mb). I am currently > using a URLConnection and things are working great on my emulator. > However, I'm fairly concerned about how this will work in the real > world. I have found very little discussions or documentation on this > subject. > > What happens when the network connection switches (3g -> wifi / wifi -> 3g)? > Will the download magically switch? Will it timeout/fail. If > > the download were on 3g and wifi came on, would it remain on 3g and > succeed? > > From a big picture level, I'm trying to answer the following > questions: > 1. Will I be able to reliably download large files without writing an > extensive amount of retry / resume functionality? > 2. Is it possible to give the user the option of enabling downloads > only on wifi for reliability/battery purposes? I'm not sure if it > will auto-drop to 3g/edge if the wifi connection is lost. > > Has anyone dealt with this? I would really appreciate any advice > regarding these issues. > > Regards, > Eddie --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

