문제

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