From aea2d763a205837aa99fc3bbb54848a90985aac5 Mon Sep 17 00:00:00 2001
From: Gilles Debunne A service is started (or new instructions are given to an ongoing
service) by passing an Intent object to {@link
android.content.Context#startService Context.startService()}.
-Android calls the service's {@link android.app.Service#onStart
-onStart()} method and passes it the Intent object.{@link android.app.Service#onStartCommand
+onStartCommand()} method and passes it the Intent object.
Similarly, an intent can be passed to The active lifetime of a service begins with a call to
-
@@ -1525,7 +1525,7 @@ services, whether they're started by
{@link
@@ -1508,9 +1508,9 @@ a music playback service could create the thread where the music will be played
in {@code onCreate()}, and then stop the thread in {@code onDestroy()}.
{@link android.app.Service#onStart onStart()}. This method
+{@link android.app.Service#onStartCommand onStartCommand()}. This method
is handed the Intent object that was passed to {@code startService()}.
-The music service would open the Intent to discover which music to
+The music service would open the Intent to discover which music to
play, and begin the playback.{@link android.content.Context#startService Context.startService()}
or
{@link android.content.Context#bindService Context.bindService()}.
-However, {@code onStart()} is called only for services started by {@code
+However, {@code onStartCommand()} is called only for services started by {@code
startService()}.
It has a {@link android.app.Service} object that's executing
one of its lifecycle callbacks ({@link android.app.Service#onCreate
-onCreate()}, {@link android.app.Service#onStart onStart()},
+onCreate()}, {@link android.app.Service#onStartCommand onStartCommand()},
or {@link android.app.Service#onDestroy onDestroy()}).
It has a {@link android.content.BroadcastReceiver} object that's