I am trying to develop an Android App that, though having an Activity, needs to run in the background as a service. The app needs to start up automatically after rebooting the phone/device.

My question is HOW to troubleshoot such requirements, since the LogCat gets disconnected when the phone is rebooted, even using "adb shell broadcast -am android.intent.action.BOOT_COMPLETED" on a connected phone. (Though possible on an emulator, I dont feel like it is able to properly replicate real-world scenarios). I would like to be able to see the Logcat messages after device restarts, thus allowing me to troubleshoot ANRs and app crashes during reboot.

Any pointers would be appreciated.

有帮助吗?

解决方案

Based on this link, I understand the closest we can get to debugging reboot errors is to use

adb logcat -v time > <localfile>

or

adb bugreport

Both of these options may not be the cleanest ways to pinpoint the issue, but atleast something is better than nothing.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top