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
This commit is contained in:
Dianne Hackborn 2009-08-22 18:26:48 -07:00
parent e1f0b0a9bc
commit 4bc4fed47b

View File

@ -141,8 +141,8 @@ public class MailService extends Service {
} }
@Override @Override
public void onStart(Intent intent, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
super.onStart(intent, startId); super.onStartCommand(intent, flags, startId);
// TODO this needs to be passed through the controller and back to us // TODO this needs to be passed through the controller and back to us
this.mStartId = startId; this.mStartId = startId;
@ -212,6 +212,11 @@ public class MailService extends Service {
} }
stopSelf(startId); 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 @Override