Android

Debug code in a class that’s inherited Service – Android

Debug code in a class that’s inherited Service

Whenever you implemented Service to do some background work, at times you may require to debug code in it. So, If you try debugging by placing a breakpoint, debugger won’t stop at the breakpoint in a Service class.

To make it wait at breakpoint and to debug code, call the following method in OnCreate() method.

android.os.Debug.waitForDebugger();

debug code

So, Now you can try debugging.

Note: Comment the above code line, If its not require to debug code.

ref link:
http://www.helloandroid.com/tutorials/how-debug-service

 

Leave a Reply

Your email address will not be published. Required fields are marked *