OSDN Git Service

Use onStartCommand() in AlertService.
authorKen Shirriff <kens@google.com>
Sun, 27 Sep 2009 22:21:09 +0000 (15:21 -0700)
committerKen Shirriff <kens@google.com>
Sun, 27 Sep 2009 23:00:36 +0000 (16:00 -0700)
This service is supposed to handle an intent, so it uses START_REDELIVER_INTENT
to make sure the intent is handled.

src/com/android/calendar/AlertService.java

index 558a8f6..6550694 100644 (file)
@@ -427,11 +427,14 @@ public class AlertService extends Service {
     }
 
     @Override
-    public void onStart(Intent intent, int startId) {
-        Message msg = mServiceHandler.obtainMessage();
-        msg.arg1 = startId;
-        msg.obj = intent.getExtras();
-        mServiceHandler.sendMessage(msg);
+    public int onStartCommand(Intent intent, int flags, int startId) {
+        if (intent != null) {
+            Message msg = mServiceHandler.obtainMessage();
+            msg.arg1 = startId;
+            msg.obj = intent.getExtras();
+            mServiceHandler.sendMessage(msg);
+        }
+        return START_REDELIVER_INTENT;
     }
 
     @Override