In this, I am going to explain AlarmManager and Notification. For Notifying Users in Android, we can use mainly 3 methods as,
DialogToastNotification
The full picture of this can seen
here
AlarmManager, we can use in two ways, as
-To start some action, if a particular event happens, -To do some particular actions in every time interval.
As specified in Android developer site,
we will use AlarmManager, when we need to do some actions, even if our application is not running. For normal timing operations use handlers.
For using AlaramManager, first we need to declare the BroadcastReceiver in Manifest file as,
<receiver android:name=".TimeAlarm" />
We need to get the object of the AlarmManager using
getSystemService(), then define an intent with parameters as the current context and the BoradcastReceiver class(TimeAlarm). Then define a pendingIntent, we will get the object of it using
PendingIntent.getBroadcast(). Now we can call the
set() of AlarmManager for doing some ac…
Comments
Post a Comment