Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to send android.intent.action.BOOT_COMPLETED from adb shell

I am building an app, which needs to start a service automatically when the device boots up.

I want to test this functionality with adb. When I issue the following command from adb

adb shell am broadcast -a android.intent.action.BOOT_COMPLETED

I get the following error.

Broadcasting: Intent { act=android.intent.action.BOOT_COMPLETED }
java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.BOOT_COMPLETED from pid=3566, uid=2000
        at android.os.Parcel.readException(Parcel.java:1683)
        at android.os.Parcel.readException(Parcel.java:1636)
        at android.app.ActivityManagerProxy.broadcastIntent(ActivityManagerNative.java:3507)
        at com.android.commands.am.Am.sendBroadcast(Am.java:772)
        at com.android.commands.am.Am.onRun(Am.java:404)
        at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
        at com.android.commands.am.Am.main(Am.java:121)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:262)

According to this answer stackoverflow.com/a/10105047/106248 others didn't face this problem.

The OS version I am testing on is Android 7.0. I am facing the same problem on both real device and emulator.

Please help me solve the problem.

Thank you

like image 218
samsri Avatar asked Oct 18 '25 04:10

samsri


1 Answers

Restarting ADB in root mode has solved this problem for me:

adb root
like image 132
Tanya Y Avatar answered Oct 20 '25 19:10

Tanya Y



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!