Notification created by IntentService uses always a wrong Intent

后端 未结 1 1230
广开言路
广开言路 2021-02-03 22:41

Problem

When the user presses Send \"Button 1\"(scroll down to see the construction of the app) a new Notification is created from the RefreshService<

1条回答
  •  情歌与酒
    2021-02-03 23:02

    My suspicion is that, since the only thing changing in the Intent is the extras, the PendingIntent.getActivity(...) factory method is simply re-using the old intent as an optimization.

    In RefreshService, try:

    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
    

    See:

    http://developer.android.com/reference/android/app/PendingIntent.html#FLAG_CANCEL_CURRENT

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