On Fri, Mar 18, 2011 at 10:56 AM, Oceanblue <[email protected]> wrote: > I have a specialized application. This is for internal-use only and > not for public release. It does extensive image processing within an > AsynTask & updates a progress bar on screen to keep the user informed > as to where it is at. Since it's thousands of images, the application > might run for hours, even a day or so before being done with all the > images. > > It is running fine when I test it with a couple of hundred images. > > If the screen times-out, the processing seems to stop (onPause() > called).
That is because the device goes to sleep. This was discussed in your StackOverflow question: http://stackoverflow.com/questions/5345344/app-seems-to-stop-working-when-the-screen-goes-to-sleep > I do not want this behaviour. Nor do I want to run it in a > service & have Android wipe it out (also I'd like the progress bar to > be updated continuously). Services can arrange for "the progress bar to be updated continuously" by communicating with an activity. You could use a service with startForeground() to minimize the odds of Android terminating your service due to old age. That being said, for internal-use-only, hacking this into a long-lived Activity is not out of the question. > So here's my workaround: I set screen time- > out value of the device to "Never", keep the device plugged > in(charging), and run the application. > > My question: is this an acceptable workaround? That is impossible for anyone but you to answer. If it is only for you, and it works for you, it is up for you to decide whether or not it is "acceptable". > Does it have any negative side effects? It might shorten the lifespan of the screen, or at least the backlight, but I don't know how long those are supposed to live. Otherwise, I can think of no particular issues. You could accomplish the same effect by putting android:keepScreenOn on a widget in your layout, such as the ProgressBar. This is how video players and similar applications allow the screen and CPU to remain on despite the user not touching the screen or otherwise interacting with the device. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9 Available! -- 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

