Hi,

you can definitively debug a service. The issue is connecting a debugger to
it

If you are using Eclipse/ADT, the first possibility is to launch another
part of your application (an activity) in debug mode to have ADT connect a
debugger to your app directly.
Then, once you see your app in the DDMS "Devices" view with a green bug icon
next to it (means a debugger is connected), you can trigger your service and
you will stop in your break points.

If you can't start an activity of your application, or if you don't use ADT,
you can force the VM to stop and wait for a debugger in your service code.
Simply put a call to
     android.os.Debug.waitforDebugger();
before your break point.

Upon reaching this line, the VM will pause. You will see a red bug icon in
the DDMS "devices" view (standalone or eclipse perspective).
>From then you need to connect a debugger. Look at the 5th column in the
Devices view, this will indicate the debugger port for this application.
Connect a remote debugger to localhost and the shown port, and the bug icon
should turn green, and the VM should resume execution (and you should stop
in your break point)

Xav


On Wed, Jul 2, 2008 at 6:15 AM, www.netthreads.co.uk <
[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I have been playing around with the api samples bundled with the SDK.
> I was trying to set a breakpoint on the AlarmService_Service.java
> 'service' example but it never gets fired even though I can see the
> service is executing.
>
> Am I correct in saying you can't debug a background service?
>
> Al.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to