I am trying to \'emulate\' a reboot (or anything else with the adb shell am
) and am unable to figure out how to reference my component. Then again, maybe I don
Try
adb shell am broadcast \
-a android.intent.action.BOOT_COMPLETED \
-n net.fstab.checkit_android/.StartupReceiver
(note the -n net.fstab.checkit_android/.StartupReceiver) to aim at a specific receiver.
Also make sure your app uses permission to receive specific broadcast intents - in this case it would be
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
You need to specify the package name before the class name (then you may write it without the package) like this:
./adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n net.fstab.checkit_android/.StartupReceiver
Practically it turns out that you just have to add a slash after the package name.
You helped me start, I helped you finish :)
Broadcast does not require specify any Receiver. This case, please just stroke
adb shell am broadcast -a android.intent.action.BOOT_COMPLETED
Hope this help.
Some apps may misbehave if BOOT_COMPLETED is received twice, instead limit broadcast to your app only:
adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -p com.example.package