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

Android - Avoid the alarm triggering when user changes date/time

I have an app that sends periodic alarms every day of the week, through the method setRepeating from AlarmManager: Intent intent = new Intent(context, AlarmReceiver.class); intent.putExtra(INTENT_TAG_ALERT_ID, lastAlertId.getId()+""); …
3
votes
1 answer

Android: Cannot save and read all values in the Bundle

I have following method which is saving three values into intent which is appended to created alarm. public static Boolean setUniqueAlarm(Long alarmId, String occurenceTime, Context context) { Boolean saveResult = null; try { …
redrom
  • 11,502
  • 31
  • 157
  • 264
3
votes
1 answer

How much delay is there when setting an inexact alarm via AlarmManager?

When using AlarmManager to set an alarm, there could be a delay in which the alarm is triggered some time after the specified time unless you set an exact alarm. Is there any guarantee on what the range of this delay could be? I want to be a…
Jason Robinson
  • 31,005
  • 19
  • 77
  • 131
3
votes
1 answer

Playing sound through STREAM_ALARM doesn't start from beginning in Marshmallow

I'm playing a sound through STREAM_ALARM: MediaPlayer mp = new MediaPlayer(); mp.setDataSource(context, notificationSoundUri); mp.setAudioStreamType(AudioManager.STREAM_ALARM); mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { …
3
votes
1 answer

Alarm Manager and Pending Intent Cancel Not Working

I schedule Alarm from Activity like. private AlarmManager mAlarmManager; mAlarmManager = (AlarmManager) ACT_ActiveSession.getAppContext() .getSystemService(Context.ALARM_SERVICE); Intent intent = new…
user4853635
3
votes
2 answers

Playing voicemail via MediaPlayer turns alarm volume silent

I play an audio file from a URL using MediaPlayer. The file plays fine, however after playback (if the app hasnt't been explicitly killed), alarm ringtone is silent. What do I need to clear/reset on end of playback to make this not happen? Code for…
Leo
  • 4,652
  • 6
  • 32
  • 42
3
votes
3 answers

Open activity already open from notification

I create an alarm with notification, but when I open MainActivity through the notification, another MainActivity is open over the previous and if I close MainActivity there is another MainActivity under. This is the code of my BroadcastReceiver: …
Slaiv206
  • 309
  • 2
  • 14
3
votes
2 answers

Android: Fire a Notification.Builder at a certain time

I have a Notification.Builder that sends a message to the notification bar as soon as I click a button. Is there a way to have the notification appear at a selected time? I looked through the Android Documentation, but didn't see anything that…
Salmononius2
  • 295
  • 5
  • 14
3
votes
2 answers

How to embed time picker in view

I've integrated TimePicker in my application successfully. Now i would like to know is there a way to embed time picker in view instead of showing it as Dialog box. Thanks in advance.
Ramesh
  • 1,252
  • 3
  • 12
  • 30
3
votes
1 answer

PendingIntent and AlarmManager

I'm trying to broadcast after 20 seconds and receive the broadcast with an extended receiver ExtendedReceiver. Here is my function that creates an alarm and sets the PendingIntent to go off after 20 seconds: public void alert() { …
Juicy
  • 11,840
  • 35
  • 123
  • 212
3
votes
0 answers

Repeating Alarms vs Sync Adapter, which one should I use?

I'm developing an Android app whose basic behavior is to show the user some pieces of information every certain configurable period of time. Those pieces of information come from my own server, so the app requests the server for new information…
Rafael Redrado
  • 493
  • 1
  • 6
  • 19
3
votes
0 answers

AlarmManager skips alarms set using set() / setExact() in a 48hrs+ cycle

In an app I have to regularly sync data to a server which happens at a fixed interval (mostly) of 5mins. I am using set() / setExact() depending upon if Build API >= 19. Now, for most of the time the alarm gets fired and does it's job but…
beerBear
  • 969
  • 2
  • 17
  • 41
3
votes
1 answer

Repeating IntentService using Timers- is it advisable?

I have an IntentService that downloads data from a server and I would like the IntentService to check for server updates at a certain interval. The following posts however advice against repeating a Service using a Timer - and instead emphasize on…
user1841702
  • 2,683
  • 6
  • 35
  • 53
3
votes
2 answers

How to schedule alarm weekly in android ?

I want to schedule an alarm according to the desired days E.g. sunday,tuesday,thursday. I have scheduled it according to time but not able to do as week days. Below is code: private void StartScheduler(Context context) { Calendar startTimmer…
3
votes
0 answers

Repeating alarm runs more than once

Intent myAlarm = new Intent(context, AlarmReceiver.class); PendingIntent recurringAlarm = PendingIntent.getBroadcast(context.getApplicationContext(), 0, myAlarm, PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager alarms = (AlarmManager)…
DillPixel
  • 955
  • 1
  • 14
  • 20