Available for download on

Wrox.com (AlarmManager)getSystemService(Context.ALARM_SERVICE);


Pendinglntent rtcIntent =

PendingIntent.getBroadcast(this, 0, new Intent(MY_RTC_ALARM), 1);


LISTING 9-26 (continued)

Pendinglntent elapsedlntent =

PendingIntent.getBroadcast(this, 0, new Intent(ALARM_ACTION), 1);

// Wakeup and fire intent in 5 hours. Date t = new Date();

t.setTime(java.lang.System.currentTimeMillis() + 60*1000*5); alarms.set(AlarmManager.RTC_WAKEUP, t.getTime(), rtclntent);

// Fire intent in 3 0 mins if already awake.

alarms.set(AlarmManager.ELAPSED_REALTIME, 30*60*1000, elapsedlntent);

// Cancel the first alarm. alarms.cancel(rtclntent);

Was this article helpful?

0 0
Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide

Post a comment