I have a background service that is active at certain times - such as when a call comes in. While working to optimize battery use I noticed that its onStartCommand() is being called every 10 minutes. I wasn't doing that, so I looked...
08-11 10:54:25.938: VERBOSE/com.dcd.monitor.MonitorService(32194): onStartCommand() on thread MonitorService(1)
08-11 10:54:25.938: WARN/System.err(32194): java.lang.Throwable
08-11 10:54:25.938: WARN/System.err(32194): at com.dcd.monitor.MonitorService.onStartCommand(MonitorService.java:83)
08-11 10:54:25.938: WARN/System.err(32194): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3053)
08-11 10:54:25.938: WARN/System.err(32194): at android.app.ActivityThread.access$3600(ActivityThread.java:125)
08-11 10:54:25.938: WARN/System.err(32194): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2096)
08-11 10:54:25.938: WARN/System.err(32194): at android.os.Handler.dispatchMessage(Handler.java:99)
08-11 10:54:25.948: WARN/System.err(32194): at android.os.Looper.loop(Looper.java:123)
08-11 10:54:25.948: WARN/System.err(32194): at android.app.ActivityThread.main(ActivityThread.java:4627)
08-11 10:54:25.948: WARN/System.err(32194): at java.lang.reflect.Method.invokeNative(Native Method)
08-11 10:54:25.948: WARN/System.err(32194): at java.lang.reflect.Method.invoke(Method.java:521)
08-11 10:54:25.948: WARN/System.err(32194): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-11 10:54:25.958: WARN/System.err(32194): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-11 10:54:25.958: WARN/System.err(32194): at dalvik.system.NativeStart.main(Native Method)
Now why might that happen? (it does have a partial wakelock on it). hmm something tells me this is staring me in the face but I'm not getting it.
Seems to me I recall reading that it's inefficient to start stuff unless needed :)
Thanks..