What is the best way to update android widget on screen_on. Is it supported in Android Oreo (API 26)

后端 未结 1 1174
予麋鹿
予麋鹿 2021-02-09 18:35

I created a widget, which was working quite fine, and then I changed targetSDK from 23 to 26, due to the requirement from Google Play Developer Console.

After switching

1条回答
  •  我在风中等你
    2021-02-09 19:25

    Finally, I've found solution to this problem.

    We can simply find answer here:

    https://developer.android.com/training/monitoring-device-state/doze-standby

    To solve the above problem, we can use Alarm Manager.

    Standard AlarmManager alarms (including setExact() and setWindow()) are deferred to the next maintenance window.

    So right after the doze mode finishes, or during a maintenance window, it will automatically execute the code, written in alarm manager service.

    You can get help here to use Alarm Manager in your widget from this stackoverflow post: https://stackoverflow.com/a/14319020/3497865

    0 讨论(0)
提交回复
热议问题