android - Alarm not triggering -
i've worked alarms many times, can't life of me trigger... doing wrong? i've tried triggering services, broadcastreceivers, everything. i've tried triggering earlier time , in future (5 seconds now). far know it's being set, it's not throwing error , log firing... nothing in alarmreceiver getting triggered.
public void setalarm() { calendar exp = calendar.getinstance(); exp.set(calendar.second, 5); alarmmanager = (alarmmanager)mcontext.getsystemservice(context.alarm_service); am.set(alarmmanager.rtc_wakeup, exp.gettimeinmillis(), pendingintent.getservice(mcontext, 0, new intent(mcontext, alarmreceiver.class), 0)); log.i("", "alarm set " + dateformat.format("mmmm dd, yyyy hh:mma", exp.gettime())); } }
public class alarmreceiver extends service { @override public ibinder onbind(intent intent) { log.d("", "onbind tiggered"); return null; } public void oncreate() { log.d("", "oncreate triggered"); } }
don't forget add service manifest!!
Comments
Post a Comment