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

1179 questions
5
votes
2 answers

How can create more than one alarm?

I am able to create and cancel an alarm with the code below. I want to create more than one alarm. Alarm times comes from an arraylist. In this arraylist I would like to create an alarm for each date. And presses of the cancel button will cancel…
realuser
  • 931
  • 2
  • 15
  • 26
5
votes
1 answer

How to start a activity from a broadcast receiver when the screen is locked in Android Q

I am trying to implement an alarm based application in Android Q using a broadcast receiver. I am running a foreground service using notification for triggering the alarm broadcast receiver. The service is working fine and it is also triggering the…
5
votes
1 answer

Android How to set exact repeating alarm?

I'm building an alarm application which will have an exact repeating alarm. Seeing how for Repeating Android provides only Inexact alarm with possible delay of 75% of chosen interval, I've tried making Exact alarm which upon triggering sets itself…
Oleksandr Firsov
  • 1,428
  • 1
  • 21
  • 48
5
votes
1 answer

AlarmManager: PendingIntent gone after swiping app from recent apps on some devices

Simple demo GitHub project: https://github.com/Try4W/AlarmManagerDemo On emulators(Android 4.1.1, Android 6): I scheduling new PendingIntent with AlarmManager check active alarms via adb shell dumpsys alarm see my Intent close app via swiping it…
Alexandr
  • 3,859
  • 5
  • 32
  • 56
5
votes
2 answers

Am I leaking Context?

I'm setting alarms in my app using AlarmManager from multiple Activities. To avoid redundant code, I created the following class: public class CustomAlarmManager { private static final String SHARED_PREF_REQUEST_CODE = "requestCode"; …
justanoob
  • 1,797
  • 11
  • 27
5
votes
1 answer

Duplicate intents after application update. Does alarms survive?

I have a bug where I'm getting duplicate intents after an update. The change I made was to start listening to the MY_PACKAGE_REPLACED, and re-register the alarm below, because I assumed that alarms were killed when the application was updated.…
5
votes
2 answers

Unable to dismiss/hide alarm icon on Android 5.0 Lollipop

Since the release of Android Lollipop 5.0 (API21), there is now an API to officially show/hide the alarm icon. There is more information about this here on stackoverflow. Thanks to it, I managed to now display the alarm icon on 5.0+ Android devices.…
5
votes
1 answer

Scheduling Repeating Tasks in a Service

I need to repeat a task every 1 hour in the background (I am sending some info to my server). I tried to use a service with a post delay handler calling it self. handler = new Handler(); runable = new Runnable() { @Override public…
ilan
  • 4,402
  • 6
  • 40
  • 76
5
votes
2 answers

How to turn off an alarm programmatically on Android

I have an Android application. When the app is running, the alarm should be muted or disabled. After closing the application, the alarm should be enabled again. I used this code: AudioManager AudiMngr = (AudioManager)…
Parthi
  • 669
  • 1
  • 9
  • 26
5
votes
1 answer

Controlling the Alarm icon in status bar

This question relates to Android versions pre-Lollipop. For Lollipop API, check related question: Lollipop API for controlling the Alarm icon in status bar I would like to know how to turn on / off the system Alarm icon in the status bar as shown…
5
votes
1 answer

What happens to running alarms when application is updated?

I need to figure out whether or not to restart that alarm because it's a timed server poll, but there should only be one instance of that alarm.
DillPixel
  • 955
  • 1
  • 14
  • 20
5
votes
4 answers

BroadcastReceiver and AlarmManager Android

I am trying to use an alarm manager with BroadcastReceiver. I try to use the example given in Tutorial: System Services and BroadcastReceiver . but when I run the example after the end of the time the toast doesn't show up. the code is below: My…
zied
  • 201
  • 3
  • 7
  • 17
5
votes
2 answers

Alarm manager not triggering alarms at exact time in android

I scheduled alarm using Calendar class as below Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY,1); cal.getTimeInMillis(); cal.set(Calendar.MINUTE,05); long TriggerMillis = cal.getTimeInMillis(); AlarmManager aManager =…
5
votes
2 answers

Schedule an event to be executed in future (Cron Job the Android way)

I have certain dates which once attained lose their relevance and new dates for these fields in the DB should be calculated, I know I can leverage the AlarmManager class for this, however I have a few concerns regarding this: 1) Note: Beginning…
Skynet
  • 7,820
  • 5
  • 44
  • 80
5
votes
3 answers

Notification on every 5 minutes

I want to give the notification to user on every 5 minutes I am using following code. it shows me notification first time but not give next time. public void startAlarm() { AlarmManager alarmManager = (AlarmManager)…
user2546410
  • 51
  • 1
  • 1
  • 5