I would think a service is definitely necessary for this case
especially that the process can be very long. The user will be
expected to press the Home key to go back to Home screen and do other
things, it is not possible to expect the user to be stop using their
phone during such a long download.

So it make sense that you have the download running in a service and
notify the user after it completes (via Toast or Notification).

I am not aware of any code/application out there that takes in a url,
downloads and broadcast the result back later.

You should also keep in mind that switching the phone configuration
(portrait to landscape) destroys the activity and creates a new
instance. So you can't rely on a local thread in an Activity.

On Mar 11, 11:03 pm, westmeadboy <[email protected]> wrote:
> If an app needs to download some critical data (without the data it
> cannot function) of several MB, what is the best practice?
>
> The app would start, a prompt would be shown to confirm download,
> download would commence, and the user would be prevented from going
> further until the download successfully completes.
>
> I don't expect the download would take more than, say, 10 secs over
> wifi but, of course, would take much longer over 2G.
>
> Is a service absolutely essential for this?
>
> Maybe there is already some code out there that takes a URL, downloads
> it in a service, and broadcasts a configurable Intent when the
> download has completed?

-- 
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

Reply via email to