Search code examples
androidactivity-lifecycle

ActivityLifecycleCallbacks before api 14


How do people use ActivityLifecycleCallbacks for apps targeting say API 10? I need to use it to start and stop a Service. Alternatively, can I start and stop a service from the manifest?


Solution

  • How do people use ActivityLifecycleCallbacks for apps targeting say API 10?

    They are not available. Instead, you put logic in all your activities, in their lifecycle methods, corresponding to the particular ActivityLifecycleCallbacks methods that you were interested in.

    Considering that devices below API Level 14 make up ~5% of the Google Play ecosystem at the present time, you might consider raising your minSdkVersion to 14 (or even 15).

    Alternatively, can I start and stop a service from the manifest?

    No, sorry.