From 4bc4fed47bec36b48203ae7dd6cd7e4727cfea70 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Sat, 22 Aug 2009 18:26:48 -0700 Subject: [PATCH] Use new service command processing to avoid leaving the service running. The service still needs to schedule an alarm in its onStartCommand() so that it will run in its next poll interval. Change-Id: I66228ef573e84a5c7d33bcb07f4772626079b960 --- src/com/android/email/service/MailService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/android/email/service/MailService.java b/src/com/android/email/service/MailService.java index 58d621d2f..faae6af03 100644 --- a/src/com/android/email/service/MailService.java +++ b/src/com/android/email/service/MailService.java @@ -141,8 +141,8 @@ public class MailService extends Service { } @Override - public void onStart(Intent intent, int startId) { - super.onStart(intent, startId); + public int onStartCommand(Intent intent, int flags, int startId) { + super.onStartCommand(intent, flags, startId); // TODO this needs to be passed through the controller and back to us this.mStartId = startId; @@ -212,6 +212,11 @@ public class MailService extends Service { } stopSelf(startId); } + + // If we get killed will syncing, have the intent sent to us again. + // Evetually we should change to schedule the next alarm in this + // function, and return START_NOT_STICK from here. + return START_REDELIVER_INTENT; } @Override