OK, so let me state where we stand at the moment. Current code to start service:
Intent myIntent = new Intent(); myIntent.setClass(MainActivity.this, SensorService.class); startService( myIntent ); I have a breakpoint at the top of the onStartCommand method of SensorService and it's never getting hit. Here's the information that appears in the log. Looks like a null pointer exception but I'm not sure which pointer is causing the trouble: D/AndroidRuntime( 221): Shutting down VM W/dalvikvm( 221): threadid=3: thread exiting with uncaught exception (group=0x4 001b188) E/AndroidRuntime( 221): Uncaught handler: thread main exiting due to uncaught e xception E/AndroidRuntime( 221): java.lang.RuntimeException: Unable to instantiate servi ce com.shipmate.SensorService: java.lang.NullPointerException E/AndroidRuntime( 221): at android.app.ActivityThread.handleCreateServic e(ActivityThread.java:2764) E/AndroidRuntime( 221): at android.app.ActivityThread.access $3200(Activi tyThread.java:119) E/AndroidRuntime( 221): at android.app.ActivityThread $H.handleMessage(Ac tivityThread.java:1917) E/AndroidRuntime( 221): at android.os.Handler.dispatchMessage(Handler.ja va:99) E/AndroidRuntime( 221): at android.os.Looper.loop(Looper.java: 123) E/AndroidRuntime( 221): at android.app.ActivityThread.main(ActivityThrea d.java:4363) E/AndroidRuntime( 221): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 221): at java.lang.reflect.Method.invoke(Method.java:5 21) E/AndroidRuntime( 221): at com.android.internal.os.ZygoteInit $MethodAndA rgsCaller.run(ZygoteInit.java:860) E/AndroidRuntime( 221): at com.android.internal.os.ZygoteInit.main(Zygot eInit.java:618) E/AndroidRuntime( 221): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 221): Caused by: java.lang.NullPointerException E/AndroidRuntime( 221): at android.content.ContextWrapper.getApplication Context(ContextWrapper.java:100) E/AndroidRuntime( 221): at com.shipmate.SensorService.<init>(SensorServi ce.java:26) E/AndroidRuntime( 221): at java.lang.Class.newInstanceImpl(Native Method ) E/AndroidRuntime( 221): at java.lang.Class.newInstance(Class.java:1479) E/AndroidRuntime( 221): at android.app.ActivityThread.handleCreateServic e(ActivityThread.java:2761) E/AndroidRuntime( 221): ... 10 more I/Process ( 53): Sending signal. PID: 221 SIG: 3 I/dalvikvm( 221): threadid=7: reacting to signal 3 I/dalvikvm( 221): Wrote stack trace to '/data/anr/traces.txt' I/ARMAssembler( 53): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x38fd48:0x38fe04] in 764133 ns I/ARMAssembler( 53): generated scanline__00000177:03515104_00001001_00000000 [ 91 ipp] (114 ins) at [0x38feb8:0x390080] in 1609632 ns I/Process ( 221): Sending signal. PID: 221 SIG: 9 I/ActivityManager( 53): Process com.shipmate (pid 221) has died. W/ActivityManager( 53): Scheduling restart of crashed service com.shipmate/.Se nsorService in 7490ms I/WindowManager( 53): WIN DEATH: Window{43cc32c8 com.shipmate/ com.shipmate.Mai nActivity paused=false} I/UsageStats( 53): Unexpected resume of com.android.launcher while already res umed in com.shipmate W/InputManagerService( 53): Got RemoteException sending setActive(false) notif ication to pid 221 uid 10024 E/ActivityThread( 53): Failed to find provider info for android.server.checkin W/Checkin ( 53): Can't log event SYSTEM_SERVICE_LOOPING: java.lang.IllegalArgu mentException: Unknown URL content://android.server.checkin/events I/ActivityManager( 53): Displayed activity com.android.launcher/.Launcher: 127 402 ms (total 127402 ms) I/ActivityManager( 53): Start proc com.shipmate for service com.shipmate/.Sens orService: pid=230 uid=10024 gids={} I/jdwp ( 230): Ignoring second debugger -- accepting and dropping D/ddm-heap( 230): Got feature list request D/AndroidRuntime( 230): Shutting down VM W/dalvikvm( 230): threadid=3: thread exiting with uncaught exception (group=0x4 001b188) E/AndroidRuntime( 230): Uncaught handler: thread main exiting due to uncaught e xception E/AndroidRuntime( 230): java.lang.RuntimeException: Unable to instantiate servi ce com.shipmate.SensorService: java.lang.NullPointerException E/AndroidRuntime( 230): at android.app.ActivityThread.handleCreateServic e(ActivityThread.java:2764) E/AndroidRuntime( 230): at android.app.ActivityThread.access $3200(Activi tyThread.java:119) E/AndroidRuntime( 230): at android.app.ActivityThread $H.handleMessage(Ac tivityThread.java:1917) E/AndroidRuntime( 230): at android.os.Handler.dispatchMessage(Handler.ja va:99) E/AndroidRuntime( 230): at android.os.Looper.loop(Looper.java: 123) E/AndroidRuntime( 230): at android.app.ActivityThread.main(ActivityThrea d.java:4363) E/AndroidRuntime( 230): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 230): at java.lang.reflect.Method.invoke(Method.java:5 21) E/AndroidRuntime( 230): at com.android.internal.os.ZygoteInit $MethodAndA rgsCaller.run(ZygoteInit.java:860) E/AndroidRuntime( 230): at com.android.internal.os.ZygoteInit.main(Zygot eInit.java:618) E/AndroidRuntime( 230): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 230): Caused by: java.lang.NullPointerException E/AndroidRuntime( 230): at android.content.ContextWrapper.getApplication Context(ContextWrapper.java:100) E/AndroidRuntime( 230): at com.shipmate.SensorService.<init>(SensorServi ce.java:26) E/AndroidRuntime( 230): at java.lang.Class.newInstanceImpl(Native Method ) E/AndroidRuntime( 230): at java.lang.Class.newInstance(Class.java:1479) E/AndroidRuntime( 230): at android.app.ActivityThread.handleCreateServic e(ActivityThread.java:2761) E/AndroidRuntime( 230): ... 10 more I/Process ( 53): Sending signal. PID: 230 SIG: 3 I/dalvikvm( 230): threadid=7: reacting to signal 3 I/dalvikvm( 230): Wrote stack trace to '/data/anr/traces.txt' W/ActivityManager( 53): Timeout executing service: ServiceRecord{43d03d08 com. shipmate/.SensorService} I/Process ( 230): Sending signal. PID: 230 SIG: 9 I/ActivityManager( 53): Process com.shipmate (pid 230) has died. W/ActivityManager( 53): Service crashed 2 times, stopping: ServiceRecord{43d03 d08 com.shipmate/.SensorService} W/InputManagerService( 53): Window already focused, ignoring focus gain of: co m.android.internal.view.iinputmethodclient$stub$pr...@43d583f0 -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en