Why widget does not work after reboot?

前端 未结 2 1708
南笙
南笙 2021-01-03 12:47

I have this simple widget and when I click on it, it should open my activity, it works, but it doesn\'t work after reboot. I must delete and then again add widget to my home

2条回答
  •  粉色の甜心
    2021-01-03 13:09

    After reboot you OnEnabled is called instead of onUpdate so move the code from onUpdate into a separate method and then call that method to update all widgets from onEnabled

提交回复
热议问题