Dianne, here's the reproduction step on Froyo:
[1] Run on Froyo - start ApiDemos, start the RemoveService sample. You
will now see two processes
com.example.android.apis
com.example.android.apis:remote
[2] You will notice that "Sample Remote Service" appears on status
bar.
[3] write an app with KILL_BACKGROUND_PROCESSES permission. Call
ActivityManager.killBackgroundProcesses("com.example.android.apis");
[4] Both processes created at step [1] are killed.
[5] RemoveService is never restarted, even though you see something
like
W/ActivityManager( 2426): Scheduling restart of crashed service
com.example.android.apis/.app.RemoteService in 20000ms
[6] "Sample Remote Service" message still stays on status bar. This is
because StatusBarService expects a ACTION_PACKAGE_RESTARTED broadcast,
but
this braodcast is never delivered.
What's the best way to handle this -- we need to clean up some
resources if
the app process is killed.
Thanks!
On Jul 29, 8:15 pm, Dianne Hackborn <[email protected]> wrote:
> Applications can't kill services with this. They can only kill background
> processes, which the OOM killer is free to kill at any time anyway.
>
> On Thu, Jul 29, 2010 at 6:37 PM, [email protected] <
>
>
>
>
>
>
>
> [email protected]> wrote:
> > On Froyo, we found that some new "Task Manager" apps are now using the
> > ActivityManager.killBackgroundProcesses() to kill apps. When this
> > happens, Intent.ACTION_PACKAGE_RESTARTED is no longer fired.
>
> > How can I find out that my application has been killed?
>
> > I tried to start a service, and I do see this message printed in
> > logcat:
>
> > W/ActivityManager( 2426): Scheduling restart of crashed service
> > com.example.android.apis/.app.RemoteService in 20000ms
>
> > However, the service is never restarted as advertised, if the app is
> > killed using the killBackgroundProcesses API.
>
> > (If I go into adb shell and kill the service process, the service will
> > indeed be restarted ...)
>
> > This looks like a bug anyway, because the notification created by the
> > app is no longer removed like in eclair (the StatusBarService, and a
> > bunch of other system services, depend on the
> > Intent.ACTION_PACKAGE_RESTARTED broadcast).
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-developers%[email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails. All such
> questions should be posted on public forums, where I and others can see and
> answer them.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en