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
0 answers

My app does not listen ACTION_MY_PACKAGE_REPLACED

I noticed when App is updated, Intents all disappear, so I need this app to listen to App update and re-send the intents, like it does with BOOT_COMPLETE AndroidManifest.xml
1011011
  • 61
  • 6
1
vote
2 answers

Where is the best place to schedule AlarmManager to do a periodic background data sync?

My Android application will be periodically polling a server to check for data. I want this polling to happen regardless of user interaction with the application, similar (in concept) to how the Gmail and Google Reader apps sync data in the…
Eric Levine
  • 13,536
  • 5
  • 49
  • 49
1
vote
0 answers

notifications with unique ids get overwritten

I am building an app where user can subscribe to get notification at a specific time. But when I try putting two notifications one after the other, things get horribly wrong. My code: myObject.setNotificationId((int) ((new Date().getTime() /…
1
vote
1 answer

Notification triggered immediately and not at the time I wanted it to be triggered

I'm relatively new to Android so I'm quite puzzled here... I want a notification to be triggered at a certain time on a daily basis. I use a Calendar class to set the time when the notification is triggered every day, and AlarmManager to set the…
Lior L
  • 49
  • 1
  • 1
  • 7
1
vote
0 answers

AlarmManager not work for date specific

AlarmManager execute in current date, but i need in 10h. My code for schedule in AlarmManager public class RecieverAlert extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Calendar calendar =…
1
vote
1 answer

Want to repeat alarm in every 20 seconds

AlaramManager will be working fine but repeat time vary device to device public void StartMoniterning() { try { Alarammanager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent alarmIntent = new Intent(this,…
1
vote
1 answer

Android Oreo: Broadcast receiver does not work when application is not in memory

I have a requirement where I need to show a notification to the user at specific times during a week. I tried using the alarm manager to achieve this. The issue I am facing is that the onRecieve() method of my broadcast listener works fine when the…
1
vote
1 answer

Android Repeating Alarm not working for the next day

I need to create alarm that will trigger a local push notification every day and valid for only a particular time. For example. Session 1 : 7 AM - 8 AM, Session 2 : 7 PM - 8 PM From above, i need to create an alarm that will send local push…
vishalaestro
  • 125
  • 1
  • 1
  • 11
1
vote
0 answers

How do I make Android AlarmManager send repeating alarm reliably?

I have written a cross-platform application using Xamarin Forms in Visual Studio 2017 for members of a social group, which provides reminders of coming events and a means to reply to invitations to attend them. Everything works in the Android…
David S
  • 31
  • 5
1
vote
1 answer

Android Alarm Not Set

I used to set alarms using the following code-segment in other projects as repeating and non-repeating, but it's now driving me crazy about what may the silly mistake be that I've made for not the alarm speaking to my current implementation :\…
Touhid
  • 731
  • 1
  • 10
  • 25
1
vote
0 answers

AlarmManager shifts time by 12 hours

I'm trying to create periodical notifications. So, I created a function to reschedule new notification time: private void rescheduleNotification(Context context) { long nextNotifTime = System.currentTimeMillis(); // Schedule next…
Romaann
  • 11
  • 1
1
vote
1 answer

Trouble with local Notifications

Recently I just transferred all my code from a Xamarin.Forms Project which had local notifications representing alarms to a Android project in Android studio. The flow of scheduling this alarm is as follows and worked just fine in the Xamarin…
B Best
  • 1,106
  • 1
  • 8
  • 26
1
vote
1 answer

Alarm Manager is not invoking Broadcast receiver

I have two issues of Alarm manager. One is i want to repeat alarm every 10 seconds and other is my Broadcast Receiver is invoking after 10 second. When i use Activity instead of Broadcast Receiver it is working But Broadcast Receiver is not working.…
Gyan S Awasthi
  • 237
  • 6
  • 14
1
vote
1 answer

Alarm manager make notification also after the date

My alarm manager works fine, but everytime I open my app AFTER the ALARM TIME it fires a notification. How can I say the alarm manager that It only do 1 notification and after the ALARM TIME it should stop. public void startTimer(int year,int month,…
user7436941
1
vote
0 answers

Editing an alarm using AlarmManager

I'm trying to make a simple homework reminder app I set an alarm with this function: void setAlarm(int year, int month, int day, int hour, int minute, int second, String lesson, String description, int id) { Intent intent1 = new Intent(this,…