Android – no intention to delete / replace
•
Android
I set the alarm clock when I click the button
The alarm is triggered by intent
This intention gets an additional "int" passed to the broadcast receiver
The problem is that the extra intention is set at the first click of the button and will never change the other clicks:
Intent intent = new Intent(A.this, B.class);
intent.putExtra(WAKEUP_DURATION, wakeUpDuration);
PendingIntent sender = PendingIntent.getBroadcast(A.this, 0, intent, 0);
I tried to delete it in the broadcast receiver, but I had no luck:
intent.removeExtra(A.WAKEUP_DURATION);
resolvent:
Use flag when creating pendingintent_ UPDATE_ Current to update the additional content of the new intent
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码