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
1 answer

Launching custom Activity when alarm goes off in custom alarm clock app Android

I know there is a lot of discussion about AlarmClock and AlarmManager and how to set alarms, launch apps, etc. However, I am yet to find the perfect answer for the following scenario. In my Android alarm clock application I'm developing, I want to…
Michael
  • 3,093
  • 7
  • 39
  • 83
1
vote
0 answers

AlarmManager timezone not synced with system clock

When I set an alarm in Using Alarm manager, it would always immediately show my alarm. I realized that this was because the alarm I was actually setting was in the past. When I use Java's Calendar.getInstance() to sync with the current time, it…
1
vote
4 answers

How to keep service alive when remove app from stack

I want to show notification every minute using Alarm Manager, I have implemented below code, it's working fine but the problem is when I remove app from stack the service is not running. I want keep alive, I have tried START_STICKY in onStartCommand…
Komal
  • 328
  • 3
  • 15
1
vote
1 answer

Why service does not work "immediately"?

I have simply functional for start service and repeat he: mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); PendingIntent pIntent = PendingIntent.getService(mContext, …
abbath0767
  • 946
  • 2
  • 11
  • 31
1
vote
1 answer

Jobscheduler after application removed from recent apps

I have jobscheduler that sends notification trigged by starting alarm and get canceled by an ending alarm, I have question, if i remove application from recent app or i reboot phone will alarm will trigged on specified time? and what happens to job…
blackHawk
  • 6,047
  • 13
  • 57
  • 100
1
vote
1 answer

How to have two alarms start two services?

I am trying to have two alarms start their own separate services. They seem to be interfering with each other though, because only one of them work at a time. Is there something I should change in my code? Or is it not possible to do this? public…
sandra burgle
  • 47
  • 1
  • 8
1
vote
1 answer

alarm manager to call an intent service, after on the on click of the button, it should cancel but the alarm manager keeps triggerring the service

The button changes at the onclick, that is why there is a flag. but the alarm manager does not stop the intent, it keeps running forever even at the onclick to cancel the alarmManager if (flag) { flag = false; …
R.R.E
  • 29
  • 5
1
vote
1 answer

How to tell if android device has been turned off

I have an re-occurring alarm manager task that needs to run nightly, However when the device is turned off then back on, it erases this task and I have no way to reset it. I would like to know how to tell if a device has been turned off and/or if…
ninjasense
  • 13,756
  • 19
  • 75
  • 92
1
vote
1 answer

Alternative for AlarmManager.setExact android api 18 and less

I am developing an android app that uses AlarmManager. The app has to be very accurate, but AlarmManager.setExact is available only from API 19 (Android Kitkat), and I have an old phone that its android version is 4 (API 16). I tried using a…
1
vote
1 answer

Service wake up randomly, with setExactAndAllowWhileIdle method

I need to wake up a service every 60 seconds (for example). The service configures itself to wake up with the following code: private void rescheduleService() { // setup calendar Calendar calendar = Calendar.getInstance(); …
Cristian
  • 514
  • 4
  • 21
1
vote
1 answer

Not able to cancel Pending Intent using Alarm manager

This is the code to set u and delete the notifications. please let me know if you need more details. The only solutions on stack overflow are about the pending intent to be same. I already tried that solution and it didn't work. public void setAlarm…
1
vote
1 answer

Android daily notification even after cancel

We are developing an application that should trigger an alarm intent notification start at 8AM everyday and repeat for every 15 mins once In the notification, we are having button called "EOD", clicking on this should cancel the alarm and should not…
Deva
  • 39
  • 1
  • 5
1
vote
0 answers

Why does scheduled notification show every 20 minutes instead of scheduled time in Android and how to fix?

I have a notification that displays a different activity when shown to encourage user engagement. The notification shows but after following the Android Developer docs, I programmed it to show at 2pm everyday and only once. Unfortunately, it shows…
Steve C.
  • 1,333
  • 3
  • 19
  • 50
1
vote
0 answers

Daily notification with alarm manager is not working

I have added everything like adding a receiver in the manifest file, adding all permissions still I am not able to call notifications. I want to give a fixed times, Example Daily morning 8:00 am, 12:00 am,9:00 pm I want to show notifications, how to…
snehasish
  • 171
  • 2
  • 10
1
vote
1 answer

Two TimePickers comparison

So I have allowed the user to pick two Dates Start and End time and connected to Notification Method that will check if the Current time is between his choosing. However the comparison doesn't seem to return the correct result. Here are the method…
1 2 3
99
100