getExtra from Intent launched from a pendingIntent

后端 未结 5 786
既然无缘
既然无缘 2020-12-02 08:31

I am trying to make some alarms after the user selects something with a time from a list and create a notification for it at the given time. My problem is that the \"shownam

5条回答
  •  广开言路
    2020-12-02 09:06

    If you change the Extra's value in the intent, then while creating the pending intent you should use the flag PendingIntent.FLAG_CANCEL_CURRENT.

    A simple example would be

    PendingIntent pi = PendingIntent.getBroadcast(context, 0,intentWithNewExtras,PendingIntent.FLAG_CANCEL_CURRENT);
    

    This is the right way and will ensure that your new values are delivered.

    Hope it helps.

提交回复
热议问题