[android-developers] Re: Froyo -- How to detect that my application has been killed?

2010-08-02 Thread tomei.ninge...@gmail.com
Hi Dianne, I understand that we need to handle app killed by LMK. If we can handle LMK, we can also handle the new Froyo kill-by-task-manager behavior. Do you have any suggestion about this: For example, let's say our app creates a 10MB cache file. When the app exits, we want to delete this

Re: [android-developers] Re: Froyo -- How to detect that my application has been killed?

2010-08-02 Thread Dianne Hackborn
Everything in the system that handles RESTARTED is to clear its state when the app is force stopped. It is all correct. Task managers can no longer force stop. Again, task managers can no longer do anything more than the low memory killer does. There is not a problem here that apps haven't

Re: [android-developers] Re: Froyo -- How to detect that my application has been killed?

2010-08-02 Thread Dianne Hackborn
Correct, onDestroy() is not called when it is killed. This is the same as activity -- the kernel kills processes when needed, not waiting for the app. The status bar is correctly keeping the icon. The service will later be restarted; it has not been stopped. It is normal for background

[android-developers] Re: Froyo -- How to detect that my application has been killed?

2010-08-02 Thread tomei.ninge...@gmail.com
As far as a cache -- you shouldn't count on your process being evicted to clear a cache.  This has problems the other way -- there is no guarantee your app will be killed *ever* while in the background, since it may never clear its cache.  You should use other policies for this.  For example,

Re: [android-developers] Re: Froyo -- How to detect that my application has been killed?

2010-08-02 Thread Dianne Hackborn
On Mon, Aug 2, 2010 at 5:44 PM, tomei.ninge...@gmail.com tomei.ninge...@gmail.com wrote: I could wait a little time after going in BG, and then clear cache. But what if the app gets killed before my timer expires? The alarm manager would allow you to wake up. I can't clear cache

[android-developers] Re: Froyo -- How to detect that my application has been killed?

2010-07-31 Thread Happy C.
Hi Dianne, I have the same issue with the froyo. I use the start service UI as the following code. //CurrentActivity.java (extend from ListActivity) Intent intent_start_service=new Intent(CurrentActivity.this,MyRunningService.class); intent_start_service.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

[android-developers] Re: Froyo -- How to detect that my application has been killed?

2010-07-30 Thread tomei.ninge...@gmail.com
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

Re: [android-developers] Re: Froyo -- How to detect that my application has been killed?

2010-07-30 Thread Dianne Hackborn
Um yeah the check for process priority does let it kill service processes (not visible or foreground service processes though). Whoops. I'll fix that. That said, the service *does* restart like it always did, and I have confirmed it does. That code path hasn't changed at all. So basically the

Re: [android-developers] Re: Froyo -- How to detect that my application has been killed?

2010-07-30 Thread Dianne Hackborn
Oh wait I take that back... what has changed is that task killers no longer go through the full force stop path -- *ALL* they can do is kill processes, and further only processes that are good or moderate candidates for the out of memory killer (pure background processes up to services running in

[android-developers] Re: Froyo -- How to detect that my application has been killed?

2010-07-30 Thread tomei.ninge...@gmail.com
Hi Dianne, Our main problem is that Intent.ACTION_PACKAGE_RESTARTED is no longer called in Froyo. (Sorry I digressed to Service ... I thought that I can implement something similar to Intent.ACTION_PACKAGE_RESTARTED by running a service from my app. If the app is killed, the Service can detect

Re: [android-developers] Re: Froyo -- How to detect that my application has been killed?

2010-07-30 Thread Dianne Hackborn
It isn't being called because the app is NOT being restarted. As I said, the ONLY thing app killers can do now is the same thing that the OOM killer does when it needs memory, and this NEVER involved a broadcast. You have lost nothing here from previous versions of the platform. On Fri, Jul 30,