diff options
| author | Dianne Hackborn <hackbod@google.com> | 2009-12-04 15:32:22 -0800 |
|---|---|---|
| committer | Dianne Hackborn <hackbod@google.com> | 2009-12-07 18:06:09 -0800 |
| commit | 0766b2d0f398dcad10e332b695bbc0cbe5011882 (patch) | |
| tree | b73da7519daba42f8415a1afbb9a571b548e56b9 /core/java/android/app/Service.java | |
| parent | 259e3384face72ea8e30696d7bae492d37d44e8b (diff) | |
Update service example code.
Switch aidl sample to match the change in ApiDemos, add sample code
to the Service class.
Diffstat (limited to 'core/java/android/app/Service.java')
| -rw-r--r-- | core/java/android/app/Service.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java index 30e1712d796e..c4e187745a64 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}. * + * <p>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 <code>handleCommand</code> method is implemented by + * you as appropriate: + * + * <pre>{@include development/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java + * start_compatibility}</pre> + * * @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. * + * <p>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: + * + * <pre>{@include development/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java + * foreground_compatibility}</pre> + * * @param id The identifier for this notification as per * {@link NotificationManager#notify(int, Notification) * NotificationManager.notify(int, Notification)}. |
