postDelayed problem

Put your problem here if it does not fit any of the other categories.

postDelayed problem

Postby mattb » Mon Jan 25, 2010 7:49 pm

Hi all,

I'm trying to setup a service that runs some code once when the service starts and then again every 8 hours. My code is pretty simple (relevant parts displayed below):

Code: Select all
   private long PUBLISH_UPDATE_DELAY = 8 * 60 * 60 * 1000;  // 8 hours

   public void onStart(Intent intent, int startId) {
      Log.i("TEST", "BootUpService START");
      super.onStart(intent, startId);;

   private Runnable publishTask = new Runnable() {
      public void run() {
         Log.i("TEST", "Sending data to server...");
         // CODE SNIPPED

         Log.i("TEST", "Sending data to server COMPLETE");
         handler.postDelayed(publishTask, PUBLISH_UPDATE_DELAY);

This works to a point, but bizarrely appears to be running the publishTask every 30 minutes, not 8 hours.

Is anyone aware of an undocumented 30 minute maximum for postDelayed, or am I missing something really obvious?

Posts: 4
Joined: Fri Nov 27, 2009 3:17 pm


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 11 guests