diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java index 30e1712d796ed..c4e187745a64a 100644 --- a/core/java/android/app/Service.java +++ b/core/java/android/app/Service.java @@ -287,6 +287,14 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac * {@link #onStart} and returns either {@link #START_STICKY} * or {@link #START_STICKY_COMPATIBILITY}. * + *

If you need your application to run on platform versions prior to API + * level 5, you can use the following model to handle the older {@link #onStart} + * callback in that case. The handleCommand method is implemented by + * you as appropriate: + * + *

{@include development/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
+     *   start_compatibility}
+ * * @param intent The Intent supplied to {@link android.content.Context#startService}, * as given. This may be null if the service is being restarted after * its process has gone away, and it had previously returned anything @@ -462,6 +470,13 @@ public abstract class Service extends ContextWrapper implements ComponentCallbac * if your service is performing background music playback, so the user * would notice if their music stopped playing. * + *

If you need your application to run on platform versions prior to API + * level 5, you can use the following model to call the the older {@link #setForeground} + * or this modern method as appropriate: + * + *

{@include development/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
+     *   foreground_compatibility}
+ * * @param id The identifier for this notification as per * {@link NotificationManager#notify(int, Notification) * NotificationManager.notify(int, Notification)}. diff --git a/docs/html/guide/developing/tools/aidl.jd b/docs/html/guide/developing/tools/aidl.jd index abfa8b17ad4f8..19d9ea1b97666 100644 --- a/docs/html/guide/developing/tools/aidl.jd +++ b/docs/html/guide/developing/tools/aidl.jd @@ -297,9 +297,9 @@ on how to keep your application secure from malware.

as method arguments.

Here is some sample code demonstrating calling an AIDL-created service, taken - from the Remote Activity sample in the ApiDemos project.

-

{@sample development/samples/ApiDemos/src/com/example/android/apis/app/RemoteServiceBinding.java - exposing_a_service}

+ from the Remote Service sample in the ApiDemos project.

+

{@sample development/samples/ApiDemos/src/com/example/android/apis/app/RemoteService.java + calling_a_service}