alarmmanager

Android - AppWidgets, AlarmManager and AsyncTask

I'm not having much luck with updating an app widget with AlarmManager generated broadcasts. Here's what I do: Initializing AlarmManager on AppWidgetProvider#onEnabled AlarmManager alarms = (AlarmManager) context.getSystemService( Context.ALARM_SERVICE); alarms.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemC...

Android - AlarmManager recovery

Thanks to TasKiller I have reliable way to shutdown updates coming to my AppWidget from the AlarmManager! Now, sarcasm aside, how do I recover from such event? So far I only see that the Alerts are resurrected only after rebooting the phone. I can stick recovery code into few places such as various Activity#onCreate that belong to my app...

Scheduling notifications in Android

Hi, I need to be able to schedule multiple Notifications at different times in the future. I tried doing this with an AlarmManager, but that isn't suitable, for the following reason. From AlarmManager.set(): "If there is already an alarm for this Intent scheduled (with the equality of two intents being defined by filterEquals(Intent)),...

Is AlarmManager.setRepeating idempotent?

In my android app, I'm setting an alarm that I want to occur repeatedly, hence using AlarmManager.setRepeating(). I don't want to keep track of whether the alarm is set myself (sounds like a bad idea that's prone to fail at some point), and there seems to be no API support for checking whether a particular alarm is already set for a giv...

Alarm not working if application gets killed

Hi, I am trying to use an alarm to set my widget layout after some minutes. Everything works correctly in normal situation but, if I try to delete the process of my application ( simulating a system kill) after the alarm is set, then no alarm is executed. Why? From documentation it seems that alarms are executed by AlarmManager service....

Why do AlarmManager broadcasts get cancelled when app gets killed?

Ok so I have two BroadcastReceiver registered. When the app is closed they both fire at the appropriate times and do the appropriate things. If the app is closed then killed (say with an AppKiller), the receivers never receive their broadcasts, and nothing happens. Presumably the same thing happens if the parent app is killed due to ...

Intent.putExtras not consistent

I have a weird situation with AlarmManager. I am scheduling an event with AlarmManager and passing in a string using intent.putExtra. The string is either silent or vibrate and when the receiver fires the phone should either turn of the ringer or set the phone to vibrate. The log statement correctly outputs the expected value each time. ...

How to reschedule Alarm Manager on Preference Change

Hi, I have an Android Service. When a phone boots up, a broadcast receiver receives a notification and it schedules the service to run repeatedly at a gap of X minutes. Henceforth After every X minutes another broadcast receiver gets those notifications and kicks the service off, which does it's job and quits. So far so good. Now I wan...

How to place a kill safe alarm fired on daily basis?

I know how to setup an alarm to fire repeatedly, but the alarm stops firing after my application is killed. How do I make sure the alarm continues to fire as it was setup? ...

Android - Having a service run every day at 4AM

Hello everyone, I would like to know the best practices for running a Service every day at 4AM. The way I think I should be doing it is to create a new repeating alarm using AlarmManager and having it run the service at 4AM. Problem is, I'm not sure where to put the code to set the alarm. Do I do it in my main activity as one of th...

Using Alarmmanager to start a service at specific time

Hi friends, I have searched a lot of places but couldnt find a clean sequential explanation of how to start a service (or if thats not possible then an activity) at a specific time daily using the AlarmManager?? I want to register several such alarms and triggering them should result in a service to be started. I'll be having a small pi...

AlarmManager and BroadcastReceiver instead of Service - is that bad ? (Timeout problem)

Hi everyone, BACKGROUND INFO: I need to update some data from the web, about every hour or so, even when my app is closed. The update of the data itself takes about 40 seconds to 1 minute. It is then saved as a Serializable to a file. This file is read when my app starts. THIS IS THE APPROACH I TOOK FOR THE MOMENT (not using a Service...

AlarmManager - How to repeat an alarm at the top of every hour?

I want for an event to fire every hour (at 5:00, 6:00, 7:00, etc...). I tried with a persistent background service with a thread but it wasn't the right solution because of: battery consumption service termination, due to android memory management So I'm trying with AlarmManager. It works if I set an alarm to fire in X seconds (using...

AlarmManager firing in emulator but not on physical device

I have an application that calls AlarmManager Intent intent; intent = new Intent(context, MyEventReceiver.class); PendingIntent appIntent = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_ONE_SHOT); AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_W...

Why is my android alarm manager firing instantly?

I am following sample code for sending an update notification every 10'seconds. The code follows and it is in an "UpdateService" for an AppWidgetProvider. If I put a Thread.sleep(10*1000); I can see the expected behavior of my servicing loop. I obviously have something fundamentally wrong that is triggering immediately. It is suppose...

Random schedule of Alarm Manager with Calendar

I'm trying to schedule my AlarmManager to wake up every day with a diffrent random time which occurs between 22:00 - 06:00. I've tried this technic, but it doesnt seems to work: public class AlarmReciver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { ...

Android AlarmManager

Ok, I've tried two examples of AlarmManager- one from the commonsware website, and one from the manning website. The code I am currently working with is from the manning website : [http://unlocking-android.googlecode.com/svn/chapter8/trunk/SimpleAlarm/][1] There are two classes, AlarmReceiver and GenerateAlarm. Anyone have any idea why ...

android intents alarmmanager

Hi, I am trying to create intents that will be set using alarmmanager. Currently, I can do this with one intent, add extra data to it (strings, but i send them as one string with a seperator), and everything works fine and goes off at the correct time. However, when I try to send multiple intents like this, they are overwritten and only ...

Running Code On First Run of Android App

Hi. I have a new earthquake notification android app thats in it's initial release version. I have a problem currently. My app has a service running in background, this schedules itself to run every X period. To schedule itself it needs to run atleast once. Currently that happens when you boot the phone. Obviously I do not want user to...

Android AlarmManager RTC doesn't pause while device is sleeping

Hi, I wrote a little widget for Android devices. The widget uses AlarmManager to set recurring updates. I'm using the RTC clock for the AlarmManager. According to the documentation, if the device is sleeping, the RTC clock wont wake up the device and the next update will be when the device is woken. I have a log file for the widget w...