Widgets configured with android:configure will receive onUpdate even if configuration is unfinished

前端 未结 3 1722
半阙折子戏
半阙折子戏 2021-02-14 14:35

This is how I configure my APP\'s widget:



        
3条回答
  •  不知归路
    2021-02-14 14:58

    "However, in the widget code itself (onUpdate), you still need to check whether configuration is complete, because APPWIDGET_UPDATE will definitely be called before configuration completion."

    This is not the way it should be. On the android developer site you can read the following...

    "The onUpdate() method will not be called when the App Widget is created (the system will not send the ACTION_APPWIDGET_UPDATE broadcast when a configuration Activity is launched). It is the responsibility of the configuration Activity to request an update from the AppWidgetManager when the App Widget is first created. However, onUpdate() will be called for subsequent updates—it is only skipped the first time."

提交回复
热议问题