Skip to content Skip to sidebar Skip to footer

Intent Extras Don't Seem To Refresh

When I press the button it calls a method which gets user input and sets it to a variable, then that variable is put to an intent extra and sent to BroadcastReceiver which decides

Solution 1:

Before recreating your alarm, cancel the first one. To do this, you recreate your Intent and call cancel on the AlarmManager. For instance, I have a method in an Alarm class that cancels it for me before starting a new one

// cancel existing logout alarmPendingIntentpendingIntent= PendingIntent.getBroadcast(context, 
     REQUEST_CODE, alarmIntent, PendingIntent.FLAG_CANCEL_CURRENT);     
AlarmManageram= (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
am.cancel(pendingIntent);

Then recreate the PendingIntent and set the new AlarmManager

This answer explains a little more

Post a Comment for "Intent Extras Don't Seem To Refresh"