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
4
votes
4 answers

startActivity for URI in Lockscreen on Android Nougat

I'm using a BroadcastReceiver that receives a broadcast from an AlarmManager. In the receiver I am starting two activities. One activity is started from a URI like this and is a third-party app: // Open spotify Intent spotify = new…
4
votes
1 answer

Intent extras are lost with a broadcast PendingIntent and AlarmManager.setAlarmClock()

I create a PendingIntent like this: Intent intent = new Intent(context, AlarmReceiver.class); intent.setAction("Foobar"); intent.putExtra(EXTRA_ALARM, alarm); intent.putExtra(EXTRA_TRYTWO, tryTwo); intent.putExtra(EXTRA_BEGAN_TIME,…
4
votes
0 answers

Do I need to explicitely specify class using intent.setClass?

I want to use AlarmManager to schedule a repeating task. Basically, I have this code: Intent intent = new Intent(INTENT_ACTION_TICK); // The following line prevents the broadcast receiver from being notified: intent.setClass(context,…
Zackline
  • 804
  • 1
  • 9
  • 28
4
votes
2 answers

setAlarmClock not exact in android marshmallow

I use setAlarmClock method of Alarmmanager for do alarm clock application. When I set alarm clock from 6.00 AM and alarm in 6.01 AM . It delay and not exact. Code when setAlarmClock. Intent intent = new Intent(getBaseContext(),…
4
votes
2 answers

TimePicker getHours(), getMinutes in API 15

I'm making a simple Alarm Clock app, to study BroadcastReceivers , the problem is getHours() and getMinutes() are only available for API 23. Is there any alternative way of achieving this? If so? Will it possible solution be applicable to higher…
4
votes
0 answers

AlarmManager triggers before scheduled time

I am trying to generate a notification after 10 minutes a particular button has been clicked.To do this I used AlarmManager and the NotificationManager classes. Below is my code MainActivity.java import android.app.AlarmManager; import…
4
votes
2 answers

Android Alarm setExactAndAllowWhileIdle unexpected behavior on Samsung

My android app is running a repeating alarm, using setExactAndAllowWhileIdle on Marshmallow. The alarm occurs every 10s and avoids doze mode by using permission REQUEST_IGNORE_BATTERY_OPTIMIZATIONS (device has agreed to ignore battery optimizations…
Jonty800
  • 482
  • 7
  • 20
4
votes
1 answer

How to setup once-per-day notification from app

I have a general question about setting up a daily data check from my app (giving a notification when some event occurs). My current approach is: From the app (onCreate) I start a service From the service I set an alarm using AlarmManager after…
devnull69
  • 16,402
  • 8
  • 50
  • 61
4
votes
2 answers

Android device reboot check if specified time to alarm is in the past

I need your help. I'm stuck with this problem. Alarms work properly. However, when device is rebooted, and the specified time stored in db is in the past (3pm) and current time is 4pm, how can I check to prevent triggering the alarm…
user1410081
4
votes
1 answer

Where Does the PendingIntent in AlarmManager.AlarmClockInfo Get Used?

The constructor to AlarmManager.AlarmClockInfo takes a PendingIntent, described as "an intent that can be used to show or edit details of the alarm clock". Where is this used by the system? I don't see anything in the Android 6.0 UI that would seem…
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
4
votes
2 answers

WakefulBroadcastReceiver doesn't receive PendingIntent from AlarmManager

I'm struggling on an app that must repeat a task with a specified interval. I want it to wakeup the device if needed. I have no idea why, but the WakefulBroadcastReceiver NEVER executes its onReceive method that should be triggered via AlarmManager.…
4
votes
2 answers

Android, How to cancel an alarm? alarmManager.cancel not working

I have an application where you can create 5 alarms where to be created are displayed in a ListView, and assume that when an element of listView the played alarm but should remove the item from the listview but the alarm is removed to reach the…
4
votes
1 answer

Android: Starting multiple pending intents as same time using Alarm Manager

in my application i want to set multiple reminders. The code i used is following, intnt = new Intent(appConxt, RempopActivity.class); intnt.putExtra("evinfo", evtime + " " + rem.getname() + "\n will start in " + remtime + "…
4
votes
1 answer

AlarmManager not repeating

I'm coding a 'simple' notificator which consists on calling to a website, checking the response and notifying if there's something new. I'm using a Service to do the http operations and I'd like AlarmManager to repeat the call to the Service with a…
Frank
  • 2,777
  • 5
  • 18
  • 30
4
votes
1 answer

How to cancel repeating task in Alarm Manager?

I want to use Alarm Manager in order to execute repeating task while my app is launched, but I have a problem with cancelling the task. That's my code: Service: public class SyncService extends Service { @Override public int…