alarmmanager

Confused about how to approach a registration and polling of messages with Android

Dear stackies, what I need to do is auto-register device if not already done and then start polling messages with the credentials I received through this registration. Now, after I read quite a bit about services, threads, asynctasks and the AlarmManager I'm totally confused about how to handle this. :-s So, there are my two main task...

Leaked Intent & AlarmManager

Hey, I am trying to create authentication system which pops up the login window if the device has been off (SCREEN_OFF) for more than INTERVAL. I have registered a BroadcastReceiver to listen to SCREEN_ON/OFF events in the onCreate() of the launchable activity: /* Listen to Screen On & Off events */ IntentFilter filter = new IntentF...

AlarmManager with pending intents to update a widget

I have a requirement where in i need to updated my widget once in every 15 seconds. There is a method called android:updatePeriodMillis but that seems to be getting fired only after 30 minutes. I took an approach of updating my Widget with the help of AlarmManager. The widget updates but the issue is it slows down the performance of th...

Alarm In Android

public class Alarm extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Intent intent = new Intent(this, AlarmReceiver.class); PendingIntent pendingIn...

Calling startActivity() from outside of an Activity?

Hi all, I'm using an AlarmManager to trigger an intent that broadcasts a signal. The following is my code: AlarmManager mgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(this, Wakeup.class); try { PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0); Long elapse...

How to run a retry when download fails in AsyncTask using AlarmManager

Hey guys, I use an AlarmManager to run a Service which tries to download a file from the web. If it fails I'd like to retry that Service in 5 minutes. Inside the Service I run an AsyncTask to run my code. As far as I know the only way I can tell if it failed or not is from the onPostExecute(). What is the best way of implementing a re...

How to schedule my android app to do something every hour

Hi guys, I want my app to access database every hour and read next record from the table then update desctop widget and send notification. I know that there is AlarmManager which I can use to register my Intents but they are deleted when the phone is turned off or rebooted. Is there any other android class/service that I would update ...

How update data exactly every seconds? AlarmManager

I want update my widget every seconds. So I use Service and Alarm Manager, but it doesn't update exactly every second. This my log list: 09-15 11:16:08.876: INFO/REPEAT(2850): time=11:16:08am 09-15 11:16:09.970: INFO/REPEAT(2850): time=11:16:09am **09-15 11:16:11.025: INFO/REPEAT(2850): time=11:16:11am 09-15 11:16:11.978: INFO/...

Android - how to raise an alert after a long time (a month or more)

What is the best way to set an long-term alert/reminder from an Android application? I'd like to display notification in a few weeks after current date. I believe there is no need to write a service for such task. Will AlarmManager do the trick? Or should application be started daily and performing check? After countdown was started, up...

Question about getting current location in Android

I have few questions about getting current location of the device. I believe only way to do that is using requestLocationUpdates(....). if I subscribe to requestLocationUpdates... with duration set to 1 hour and after 1 hour if my phone is sleeping (or during that 1 hour I rebooted my phone), does the listener still work? A. If yes...

android: running a background task using AlarmManager

I am writing an app which needs to periodically check the server for new messages and notify the user. I have seen some examples using AlarmManager to hit a BroadcastReciever which seems like the right thing to do, but i cant seem to get it to work. Can anyone show me a step by step tutorial for this sort of thing (repeating alarm which...

Android AlarmManager set function doesn't work?

Hi, I want to add an alarm, so I used the following code: public void SetAlarm(Alarm alarm) { mTimeTarget = PendingIntent.getBroadcast(mContext, alarm.getRowID(), new Intent(HomeScreen.ACTION_CHECK_TIME_ALARMS), PendingIntent.FLAG_UPDATE_CURRENT); mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, alarm.ge...

set the time in Alarm manager Android - alarm fired instantly

I have this code which will call alarm notification public static Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(System.currentTimeMillis()); cal.add(Calendar.HOUR_OF_DAY,hour); cal.add(Calendar.MINUTE, min); Intent intent = new Intent(this, OnetimeAlarmReceiver.class); PendingIntent pendingIntent = PendingIntent.getBroadc...