Question

I want to make my home screen widget updates once every day (at 24:00). Should I use a service, or is there another way?

I want to conserve battery charge.

Était-ce utile?

La solution

You can set the update interval in WidgetProviderInfo to one day, but then you have no influence on the time the update is running.

Easiest way is to set the update interval to every hour and read in onUpdate the current time. You ensure this way that your process runs at least between 0 and 1 am.

A Service makes sence if your process runs long and should therefore stay away from the UI Thread.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top