[android-developers] Re: Froyo -- How to detect that my application has been killed?
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); startService(intent_start_service); I always get the following log message after starting the service around 30 mins~2hours, and the service is not working anymore. 07-31 15:03:00.001: INFO/ActivityManager(85): No longer want com.Myapplication (pid 4726): hidden #16 07-31 15:03:00.091: WARN/ActivityManager(85): Scheduling restart of crashed service com.Myapplication/.MyRunningService in 5000ms 07-31 15:03:05.131: INFO/ActivityManager(85): Start proc com.Myapplication for service com.Myapplication/.MyRunningService: pid=5045 uid=10077 gids={} The MyRunningService seems to be killed by the OOM, and the notification icon on the status bar with Ongoing is also shown to the user. Besides, I don't see any message from my customized log message in the onDestroy() of this service. //MyRunningService.java public void onDestroy() { Log.e(TAG,Oh!!MyRunningService was killed ); } // The issues: 1. Why MyRunningService is always killed by the OOM? Can I prevent it or can I detect the killing behavior by the service itself and restart the service automatically with some good solution? 2. Is there any way to clean the notification icon as the service is been killing ? Thank you very much! On 7月31日, 上午3時38分, Dianne Hackborn hack...@android.com wrote: For the behavior you are seeing, are you using the bind server instead of the start service UI? If you do that then yes your service will not be restarted -- because the process that is bound to it is in the background, so free to be killed, and once it gets killed the binding goes away and the service does not need to run any more. But this exact behavior is expected to happen when the device is low on memory, so it is something apps need to deal with correctly anyway. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How does forceStopPackage work in Android 2.2 (Froyo)?
Thanks Dianne's reply. What is the main difference between killBackgroundProcesses and forceStopPackage? or forceStopPackage is equal to the restartPackage in Android 2.1? Thanks again. On 6月25日, 上午8時26分, Dianne Hackborn hack...@android.com wrote: Yes it is an internal API. On Thu, Jun 24, 2010 at 4:13 PM, Happy C. taiwanhappin...@gmail.com wrote: How does forceStopPackage work in Android 2.2 (Froyo)? Thanks Google released 2.2 source code. In this code-InstalledAppDetails.java It shows how android 2.2 do the force close function. private void forceStopPackage(String pkgName) { ActivityManager am = (ActivityManager)getSystemService( Context.ACTIVITY_SERVICE); am.forceStopPackage(pkgName); checkForceStop(); } However forceStopPackage method is not in ActivityManager class. http://developer.android.com/reference/android/app/ActivityManager.html Is it a interneal API? Many Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubs-cr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How does forceStopPackage work in Android 2.2 (Froyo)?
How does forceStopPackage work in Android 2.2 (Froyo)? Thanks Google released 2.2 source code. In this code-InstalledAppDetails.java It shows how android 2.2 do the force close function. private void forceStopPackage(String pkgName) { ActivityManager am = (ActivityManager)getSystemService( Context.ACTIVITY_SERVICE); am.forceStopPackage(pkgName); checkForceStop(); } However forceStopPackage method is not in ActivityManager class. http://developer.android.com/reference/android/app/ActivityManager.html Is it a interneal API? Many Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] When will Android 2.2 source code release
Does anyone know this news? Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Kill an app / package in API 8 (Froyo)
Hi Dianne, Sorry to bother you. Does the Force stop in the setting of android 2.2 also use KillBackgroundProcess or use the system level API (developer can't use directly) to make it? I have tried the KillBackgroundProcess and adding the related permission, but it can't stop the running app either or running service like Force stop does. //ddms under Force stop 06-15 22:08:10.505: INFO/ActivityManager(62): Force stopping package com.MyTestApp/com uid=10037 06-15 22:08:10.505: INFO/Process(62): Sending signal. PID: 647 SIG: 9 //ddms under my KillBackgroundProcess 06-15 22:05:32.725: INFO/Process(62): Sending signal. PID: 638 SIG: 9 06-15 22:05:32.754: INFO/WindowManager(62): WIN DEATH: Window{43f4b2d8 com.MyTestApp/com.MyTestApp.act1 paused=false} 06-15 22:05:32.754: INFO/WindowManager(62): WIN DEATH: Window{43fbd930 com.MyTestApp/com.MyTestApp.act2 paused=false} Force stop and my KillBackgroundProcess seems to have sent the same signal 9. but they behave differently. I don't know why it doesn't work in my KillBackgroundProcess. Thanks very much! On 6月3日, 上午6時41分, Dianne Hackborn hack...@android.com wrote: On Wed, Jun 2, 2010 at 1:18 AM, Lee lee.wil...@googlemail.com wrote: killBackgroundProcesses works (you need a permission for it), but it merely restarts the background services, so it's a little poorly named. Actually it does exactly what it says -- it kills a process. If an application has a service that it wants to keep running, the normal behavior of the system kicks in to restart the service for the app. As the documentation says, this allows the app to do the same thing is the out of memory killer (killing processes) without breaking applications by causing their services to be stopped when they don't expect (or unregister their alarms or the other things that fully stopping an app does). -- Dianne Hackborn Android framework engineer hack...@android.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en