Questions tagged [android-alarms]

Android alarms is the facility provided by Android through AlarmManager to start an intent at a given time (by passing a pending intent).

Android alarms is the facility provided by Android through AlarmManager to start an intent at a given time (by passing a PendingIntent) which can be used to start an activity or a service or send a broadcast.

AlarmManager Class Reference

1165 questions
91
votes
6 answers

Android: How to use AlarmManager

I need to trigger a block of code after 20 minutes from the AlarmManager being set. Can someone show me sample code on how to use an AlarmManager in ِAndroid? I have been playing around with some code for a few days and it just won't work.
Tom
  • 7,016
  • 9
  • 32
  • 35
52
votes
3 answers

does Alarm Manager persist even after reboot?

I am really new to android, I have been researching about alarms. I want to alarm if there is a birthday on that day. I've have used alarm manager. I was confused because i have read that it clears after reboot. I don't have an android phone so I'm…
Xelamae
  • 553
  • 1
  • 4
  • 7
42
votes
3 answers

Running task periodicaly(once a day/once a week)

I want to run some task (i.e. get my web site news page) periodically (once a week/ a day), even if my application is closed. Is it possible?
siemian
  • 510
  • 1
  • 4
  • 10
42
votes
3 answers

Android Set Multiple Alarms

I'm trying to implement an Android app that needs to alarm (or to alert) multiple times along the time. I've already searched, but the nearest I found was a fixed-number of alarms set, and I guess the example didn't work. What I want to know if…
Sammy
  • 687
  • 2
  • 7
  • 25
35
votes
7 answers

Samsung "App optimisation" feature kills background applications after 3 days

We are currently developing an Android app that is a fitness-tracker application. It runs constantly in the background, and it works fine on most devices, but we've been having issues with the application dying completely on some Samsung devices.…
30
votes
5 answers

Difference between setRepeating and setInexactRepeating of AlarmManager

What are the parameters of the following: alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_FIFTEEN_MINUTES, alarmIntent); And of the following:…
User3
  • 2,105
  • 6
  • 35
  • 73
25
votes
2 answers

Alarm Manager - Scheduling multiple Non-repeating events

In Android Alarm Manager, how can we schedule multiple alarms which are non-repeating and do not have fixed intervals to repeat? I cannot use 'setRepeating' function as the alarms don't have any repeating pattern. I have the alarm times stored in…
inder
  • 541
  • 1
  • 5
  • 9
23
votes
4 answers

Alarm Clock application source code

Is there a way to get the Alarm Application source code for customizing the existing default source code availble in Android 2.3.
Sree
  • 231
  • 1
  • 2
  • 4
23
votes
3 answers

Start AlarmManager if device is rebooted

In my app I want to run some code every day at a specific time using an AlarmManager. In the android documentation I found this: Registered alarms are retained while the device is asleep [...] but will be cleared if it is turned off and…
Cilenco
  • 6,264
  • 15
  • 62
  • 128
22
votes
1 answer

Identify and cancel an alarm send to an AlarmManager

If I use the AlarmManager to schedule an alarm (a PendintIntent which should be send), how can I identify that alarm later to cancel it? Can I cancel all alarms scheduled by my app?
cody
  • 5,377
  • 13
  • 47
  • 69
19
votes
4 answers

Android Alarm Manager setExactAndAllowWhileIdle() not working in Android 7.0 Nougat in Doze mode

I am trying to make an alarm fire in my app every 30 minutes using Alarm Manager's setExactAndAllowWhileIdle but it is not working! I test the functionality by issuing a push notification whenever I receive an alarm signal. The problem is: when the…
18
votes
1 answer

How to create persistent alarms even after rebooting

Presently, I am working on app that works like "To Do Task List". I have successfully implemented the NotificationService and SchedularService in my application. Also I am getting the alerts(Notifications) at the time set for the tasks. Here are my…
Chintan Soni
  • 22,543
  • 24
  • 96
  • 158
17
votes
2 answers

Android start running JobScheduler at specific time

I want to start a JobScheduler at a specific time everyday, and finish it after 3 hours. I have the part of triggering the job every 20 min, and for 3 hours, but in JobInfo.Builder class there's no option for starting the job at an exact…
Dus
  • 3,594
  • 4
  • 22
  • 44
15
votes
1 answer

How can I set exact, repeating alarms in Android 4.4?

Right now, I am setting alarms like this: AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(context, AlarmReceiver.class); PendingIntent pendingIntent =…
Kala J
  • 1,958
  • 4
  • 40
  • 77
14
votes
5 answers

Android Galaxy S4 -- Activity that is visible over lock screen

A few years ago, I wrote an alarm app that worked on Android 2, and I'm now trying to upgrade it to work on Android 4. Specifically, on the Samsung Galaxy S4. On Android 2, if the phone was sleeping, it would wake the phone up and display a "Snooze…
1
2 3
77 78