Questions tagged [alarmmanager]

Android class providing access to the system alarm services.

AlarmManager class provides access to the system alarm services. These allow you to schedule your application to be run at some point in the future. When an alarm goes off, the Intent that had been registered for it is broadcast by the system, automatically starting the target application if it is not already running. Registered alarms are retained while the device is asleep (and can optionally wake the device up if they go off during that time), but will be cleared if it is turned off and rebooted.

The AlarmManager holds a CPU wake lock as long as the alarm receiver's onReceive() method is executing. This guarantees that the phone will not sleep until you have finished handling the broadcast. Once onReceive() returns, the AlarmManager releases this wake lock. This means that the phone will in some cases sleep as soon as your onReceive() method completes. If your alarm receiver called Context.startService(), it is possible that the phone will sleep before the requested service is launched. To prevent this, your BroadcastReceiver and Service will need to implement a separate wake lock policy to ensure that the phone continues running until the service becomes available.

AlarmManager reference

4606 questions
1
vote
2 answers

Run code every day at a specific time - AlarmManager

Currently, I am trying to run a piece of code at a specific time. After some research, I think the correct way to go is to make usage of the AlarmManger. The code should be executed every day at 3 am. If the phone is at 3 am shut down, the code…
MyNewName
  • 1,035
  • 2
  • 18
  • 34
1
vote
0 answers

How to restart alarms from AlarmManager when Task Manager kills application

I am making an Android application where I schedule alarms in AlarmManager that trigger notifications to the user and need to go off at rigid specific times. When a user uses a task killing program (usually from a chinese phone and ROM), the alarms…
1
vote
1 answer

How to stop service using AlarmManager

I have an alarm manager that runs a service repeatedly every minute. I want to stop the alarm manager using a button. The alarm manager stops when I am inside the app but when it comes out of the app and I want to stop the clock again, it will not…
1
vote
2 answers

Automatically detect if the system date has changed

I am trying to start a countdown timer whenever system date has changed or the user has changed the system date manually. I have used this broadcast action to detect if the system date has changed but it's not working. There are lot of threads on…
1
vote
2 answers

Kotlin AlarmManager and BroadcastReceiver not working

I'm trying to set an alarm with AlarmManager, but my BroadcastReceiver never gets called. Here is my snippet. val receiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { //Never…
Tyler
  • 19,113
  • 19
  • 94
  • 151
1
vote
1 answer

Schedule Alarm manager to run a method every Thursday

For example i want to have an alarm that will fire every Thursday at 12PM How would i do this? I have something implemented but isnt working properly,with the code that i have, today is wednesday 15, if change the date of the phone to 16 thrusday,…
Phill
  • 407
  • 1
  • 8
  • 30
1
vote
0 answers

FirebaseJobDispatcher or AlarmManager?

To make things clear from the start, here is the app desired flow : precise date with day/hour/minutes is selected -> a new Job is created and scheduled with FirebaseJobDispatcher -> the job is triggered exactly at the right date, and runs…
David Seroussi
  • 1,650
  • 2
  • 17
  • 34
1
vote
0 answers

Reset multiple Alarms after device reboot

I see this question has been asked many times before but I just want to make sure I have it right. After my device is rebooted my BroadcastReceiver (AlarmReceiverBoot extends BroadcastReceiver) is fired and I am able to Toast in if…
Stingalingaling
  • 173
  • 2
  • 9
1
vote
0 answers

Using setExactAndWhileIdle method for sdk 23

I want to use below code for a run different method for different SDK but when I wrote setExactAndWhileIdle in SDK_INT 23, cannot resolve this method! I wrote my gradle in below. Please if you know, help me. @SuppressLint("NewApi") private void…
Fahim
  • 384
  • 5
  • 20
1
vote
2 answers

Reminder in Android doesn't repeat

I'm trying to set a reminder in my Android app, which will go off on certain days at the same set time. Everything works fine for the first alarm, but then it doesn't repeat, nor goes off for other days. Following is the interface: Clicking on…
1
vote
2 answers

Android Alarm Manager - alarm firing on random time

Im a just new in android and im currently working on scheduler app.This is my code on setting alarm using SQLite db values. My problem here is that the alarm is triggering on random time. public void startAlarm() throws ParseException { Date dt…
CJ Caimoy
  • 51
  • 6
1
vote
1 answer

How to use AlarmManager with the data that is stored in SQLite Database?

I am making an alarm application where the user selects date and time. The data is stored in an SQL database. What i want to do is to call a notification once that time is reached. I tried doing this by simply using the time slected by the user, but…
ItsMeElvis
  • 21
  • 5
1
vote
0 answers

How to fire alarm at exact current time when I click

I'm trying to fire my alarm on the current time when I click, with interval of 5 min, where my alarm is not firing when I am clicking rather it was playing after some time interval. Example: My pending intent was set at 12:55:03 and my first alarm…
sudha
  • 193
  • 13
1
vote
1 answer

Implemet Auto Logout Function

I have a requirement to logout the user from the app everyday at 3 PM. I need to call an logout API everyday at 3 PM. My Android version is 4.4.4. I have implemented this functionality with alarmManager.It is not triggering at exact time (Sometimes…
vijeesh
  • 1,317
  • 1
  • 17
  • 32
1
vote
0 answers

Alarm manager won't work on app closed

I'm trying to set events with AlarmManager, but I'm getting notifications only when the app is opened. I tried with set, setExact and setExactAndAllowWhileIdle but with no luck : when i close the app, even when I don't turn off the screen, I won't…
Gueg
  • 127
  • 1
  • 11