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