I have been developing a PhoneGap application for Android which contains a Background Service. My question is: How can I debug this service? Is it possible to debug using an AVD and go step by step? or can I use my own device to achieve that?
Thanks!
Specific to intellij Idea, although there may be an equivalent solution for eclipse also, I am adding a few more points to Shishupal's answer which worked for me, We need to add
android.os.Debug.waitForDebugger();
in the service code.But along with above, we need to uncheck "Deploy Application" and select "Do not launch Activity".
In version 12.1.4 it looks like this:
Yes, it can be done using AVD or device. Check out http://www.helloandroid.com/tutorials/how-debug-service and Debugging a service.
You can debug your service by putting a single statement , I am mentioning it here :
You can use your usual logs -for not in-depth debugging- inside the service and then use monitor tool to view those logs when the app is in the background or closed.
To open the monitor tool: