Android: Alarm's BoradcastReceiver class takes wrong Integer Extra from Intent object
-
29-10-2019 - |
Frage
I am developing an application where there are 3 buttons.Say,button_1 for 5 min, button_2 for 10 min , button_3 for 15 min.
when user clicks on one of the button,i set alarm for that time.I am using OneShotAlarm.class
as BroadcastReceiver for alarm.I put alarm_time(5,10 or 15 min) in intent to fire alarm like,
Intent alarm_intent = new Intent(context, OneShotAlarm.class);
alarm_intent.putExtra(SNOOZE_TIME, 5);
and I am trying to retrieve this in OneShotAlarm.class
,but somehow,it keeps on taking 5 there whatever I put into intent at the time of setting alarm.
Though alarm fires for all options correctly and at correct time,but I don't get the value properly in OnShotAlarm.class
from intent's Integer extra.
I use same alarm request code for all alarms,but creates new objects everytime for setting up alarm.This is,if it concerns.
Hope,I cleared the question enough.Please help me pointing out what I am missing?
EDIT :
I forgot to specify that these three buttons are in a widget and I use a broadvcast receiver to catch their clicks.Sorry for the inconvenience when you tried to put your effort to help me!
Keine korrekte Lösung