質問

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.

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top