arnouf wrote:
> When it's installed and used by user, a Thread is launched to refresh
> view (like a flipper).

Try to avoid doing that.

Use updatePeriodMillis in your app-widget XML, and set it to a nice long
value, then process the update event in your AppWidgetProvider, perhaps
using an AsyncTask if whatever you need to do would take too long.

Or, use AlarmManager with a nice long interval, triggering an IntentService.

> Even if the screen is off, the thread is continuing...perfect for
> me...

Don't do that. See above.

Moreover, users cannot see your app-widget when the screen is off.

> But after 3 minutes, it's stopped.

The phone goes to sleep after a while, stopping the CPU. This is very
very important for battery life. Even just occasionally waking up to do
some work can cut significantly into battery life.

I strongly encourage you to watch the following Google I/O presentation:

http://code.google.com/events/io/sessions/CodingLifeBatteryLife.html

> Does it a VM restriction avoiding some bad development usage?

Depends. If I say "yes", will you use one of the techniques outlined
above? ;-)

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 2.0 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to