Posts Tagged ‘Dialog’

Android: How to Use the Alarm Manager Service

1 Comment »

Sample Code: Click Here

The AlarmManager is a useful system service that allows you to schedule when you want to have your application code run at a certain time. To use this service you need to set an alarm in the form of a PendingIntent and the time (in milliseconds) when you want it to go off. You also have the ability to set up a repeating alarm by specifying the interval in milliseconds of which the alarm should repeat.

When you set alarms using the AlarmManager it must be an intent broadcast. This means you will need a class that derives from BroadcastReceiver in order to handle the messages. This is defined in the AndroidManifest.xml file using the <receiver> tag. Inside this tag you must also define a custom action which will be used when instantiating the broadcast intent. This is used to distinguish your alert from all the other alerts flying around your device.

Read the rest of this entry »