AppWidgetProvider: not called onEnabled method

前端 未结 2 485
一整个雨季
一整个雨季 2021-01-16 15:59

I have widget that display data from content provider. I want to know when data in content provider changes. As far as I know way to do it is

context.getConte

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-16 16:39

    You need to add android.appwidget.action.APPWIDGET_ENABLED as another action:

    
        
        
        
          
    
    

    Without that, you will not receive the broadcast that triggers onEnabled().

    note: APPWIDGET_DELETED for onDeleted(...), APPWIDGET_DISABLED for onDisabled(...)

提交回复
热议问题