Search code examples
javaandroidadbalarmmanager

How to check if Boot_Complete was fired


I want to reset some alarm that starts a job scheduler after rebooting the phone, but this didn't happened so I wanted to know if BOOT_COMPLETE was received in my application, I'm testing like this while phone is connected to adb I restart phone so my phone is disconnected from adb and it shows in log, and I no longer see logs, how can I reconnect or able to see logs, is there adb command? to see logs of BOOT_COMPLETE broadcast, is there any command to connect adb at runtime while application is running?


Solution

  • First make sure that you can run "adb" by: use combination of Window + R > type "adb shell". It look like below

    adb shell

    1.Open text editor such as Notepad, Notepad++, ...

    2.Copy and paste below text

    @echo OFF
    :a
    adb logcat -s "YOURTAG"
    goto a:
    

    Replace YOURTAG text by your LogTag.

    For example, in your code

    Log.d("MyLogTag","what you want to log");
    

    Then

    @echo OFF
    :a
    adb logcat -s "MyLogTag"
    goto a:
    

    3.Save it as log.bat (If you cannot do this, First save it as log.txt, then rename this file as log.bat

    4.Restart phone. While phone is restarting, open this file by double click and wait

    Then you can see the logs from your application