Frage

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.

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top