Multiple Instances of Pending Intent

前端 未结 1 659
予麋鹿
予麋鹿 2020-12-02 19:57

I created a widget that when clicked activates a PendingIntent. The problem is when I have more than one widget on the screen only the latest one will start the PendingInte

相关标签:
1条回答
  • 2020-12-02 20:28

    So happens that after posting my question, I came up with an answer. I pass in my appWidgetId as the "unique" request code and voila! Here is the snippet now:

    Intent openApp = new Intent(context, RunningTally.class);
        openApp.putExtra("widgetId", appWidgetId);
        PendingIntent pendingAppIntent = 
            PendingIntent.getActivity(context, appWidgetId, openApp, 
                                      PendingIntent.FLAG_CANCEL_CURRENT);
        views.setOnClickPendingIntent(R.id.openFull, pendingAppIntent);
    
    0 讨论(0)
提交回复
热议问题