Reputation: 557
I have an app that also has a NotificationListenerService
. When I add breakpoints in that NotificationListenerService
, it appears that the breakpoints halt the execution, but the debugger does not recognize it.
The debugger does not seem to see that the execution has paused, and does not activate the continue button nor does it show anything in the service as far as variables. Once this happens the first time, it appears that the service is stopped permanently.
A reboot seems to get things going again sometimes but only if you run the app in normal mode (not debugger mode) before you shut the device off. I tried reattaching the debugger as well, and that does not seem to work. Strangely, I did get it working once or twice. Not sure how.
Does anyone know how to attach the debugger correctly so you can debug the NotificationListenerService
?
I found this potentially related question:
, but neither have good answers and neither discuss using the debugger.
Upvotes: 4
Views: 876
Reputation: 3918
The NotificationListenerService runs on your main application thread. So to debug first set the debug points and then from Android studio toolbar select "Attach debugger to Android process".
Select your application main process. Now you will be able to debug your service. Hope it helps!
Cheers
Upvotes: 1