"Planning a restart of the emergency service," but the call to onStart () should not be

In API 1.6, is there a way to ensure that the onStart () method of a service is called after the service is killed due to memory pressure? From the logs, it seems that the β€œprocess” to which the service belongs is restarted, but the service itself is not. I put a call to Log.d () in the onStart () method, and this is not achieved.

To test my service under pressure from memory, I create it from activity, then I launch a web browser and visit some sites with heavy Javascript, such as Slashdot, until my service is killed. The logarithm reads:

03-07 16:44:13.778: INFO/ActivityManager(52): Process com.kostmo.charbuilder.full (pid 2909) has died. 03-07 16:44:13.778: WARN/ActivityManager(52): Scheduling restart of crashed service com.kostmo.charbuilder.full/com.kostmo.charbuilder.DownloadImagesService in 5000ms 03-07 16:44:13.778: INFO/ActivityManager(52): Low Memory: No more background processes. 03-07 16:44:13.778: ERROR/ActivityThread(52): Failed to find provider info for android.server.checkin 03-07 16:44:13.778: WARN/Checkin(52): Can't log event SYSTEM_SERVICE_LOOPING: java.lang.IllegalArgumentException: Unknown URL content://android.server.checkin/events 03-07 16:44:18.908: INFO/ActivityManager(52): Start proc com.kostmo.charbuilder.full for service com.kostmo.charbuilder.full/com.kostmo.charbuilder.DownloadImagesService: pid=3560 uid=10027 gids={3003, 1015} 03-07 16:44:19.868: DEBUG/ddm-heap(3560): Got feature list request 03-07 16:44:20.128: INFO/ActivityThread(3560): Publishing provider com.kostmo.charbuilder.full.provider.character: com.kostmo.charbuilder.provider.ImageFileContentProvider 
+6
android
source share
1 answer

As you can see from the Chistopher comment above, although the log has a value of " Scheduling restart of crashed service ", this does not really mean that the onStart() method will be called. However, onCreate() will indeed be called, and your application can call onStart() from there.

+6
source share

All Articles