Alarms in Android

+2 Rehman . · February 7, 2015
I just wanted to know that where do "Alarm classes" lie in services or in broadcast receiver ?
Can anyone tell me about the brief introduction that from where they are originated and which category they lie ?

Post a Reply


Oldest  Newest  Rating
0 kishor joshi · February 10, 2015
+1 Rehman . · February 10, 2015
Thanks for your time for answering kishor, but i made this question after reading , if you see there are some conflicting views which i'm trying to understand as they say in the documentation about Alarms they say this class provides services and then i get conflicted with intents which gets generate over asleep phone as a receiver. So i mean what is it ? A service or a receiver ?
0 AKT Arun · February 10, 2015
I'll tell you what I know about receivers and services. We register a BroadcastReceiver for receiving some event. And we will do whatever we want when that event happens. So, who triggers that event? a Service. Its the same with AlarmManager, push notifications, etc. When a particular event is triggered, all receivers registered for that event will be notified. 
+1 Rehman . · February 10, 2015
okay AKT Arun aren't receiver act separately ? i mean the even triggering aren't done by receivers only ? Service meant to be work on background only or could you please brief it a little ? 
0 kishor joshi · February 10, 2015
@AKT Arun given good explanation.
reciever receive event that is triggered from some other android components like pending Intent.
There are many examples in Internet where you can see AlarmManager with Broadcast receiver then youmight get answar what you want
0 AKT Arun · February 11, 2015
Each receiver acts independently when the specified trigger is fired. a Receiver receives an event, that's why they are called receivers. When it comes to alarm manager, the event is triggered by an alarm manager service which is part of the system. If you want you can try creating a service and trigger a custom event. Then set a Receiver to receive that particular event. Do not get too deep into events and receivers until you get a clear picture of the basics. Just so you know, there are two basic type of event triggers. Depending on your application, sometimes you might even want to re trigger an event and so on. Its advanced android stuff. :)
  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator