Keep Android debugger alive even after device restart
- Open your device "developer options" settings;
- Scroll down to "select debug app" and make sure your app is selected there;
- Check the option "wait for debugger".
This will make sure that when your app is executed, for example when it receives a BOOT_COMPLETED
broadcast, the debugger gets attached first.
Hope it helps.