@javamain86

Как получить разрешение для автостарта (чтобы при старте оно загружалось) для приложения под Андройд (Android)?

Я все делал по статье, чтобы получить сообщение от Андройда об конце загрузки (BOOT_COMPLETED ):
https://habr.com/ru/articles/271663/
у меня не получилось сделать
adb shell
am broadcast -a android.intent.action.BOOT_COMPLETED
при этом программа падает с исключениями:
root@javamain-pc:~# adb devices
List of devices attached
adb-95185b77bfaf4da9-anfFQP._adb-tls-connect._tcp device

root@javamain-pc:~# adb shell
m broadcast -a android.intentt.action.BOOT_COMPLETED <
Broadcasting: Intent { act=android.intentt.action.BOOT_COMPLETED flg=0x400000 }
Broadcast completed: result=0
m broadcast -a android.intent.action.BOOT_COMPLETED <
Broadcasting: Intent { act=android.intent.action.BOOT_COMPLETED flg=0x400000 }

Exception occurred while executing 'broadcast':
java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.BOOT_COMPLETED from pid=6005, uid=2000
at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:16069)
at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:15927)
at com.android.server.am.ActivityManagerService.broadcastIntentWithFeature(ActivityManagerService.java:16741)
at com.android.server.am.ActivityManagerShellCommand.runSendBroadcast(ActivityManagerShellCommand.java:746)
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:198)
at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98)
at android.os.ShellCommand.exec(ShellCommand.java:44)
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:10514)
at android.os.Binder.shellCommand(Binder.java:929)
at android.os.Binder.onTransact(Binder.java:813)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:5053)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2875)
at android.os.Binder.execTransactInternal(Binder.java:1159)
at android.os.Binder.execTransact(Binder.java:1123)
m broadcast -a android.intent.action.BOOT_COMPLETED <
Broadcasting: Intent { act=android.intent.action.BOOT_COMPLETED flg=0x400000 }

Exception occurred while executing 'broadcast':
java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.BOOT_COMPLETED from pid=6010, uid=2000
at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:16069)
at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:15927)
at com.android.server.am.ActivityManagerService.broadcastIntentWithFeature(ActivityManagerService.java:16741)
at com.android.server.am.ActivityManagerShellCommand.runSendBroadcast(ActivityManagerShellCommand.java:746)
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:198)
at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98)
at android.os.ShellCommand.exec(ShellCommand.java:44)
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:10514)
at android.os.Binder.shellCommand(Binder.java:929)
at android.os.Binder.onTransact(Binder.java:813)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:5053)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2875)
at android.os.Binder.execTransactInternal(Binder.java:1159)
at android.os.Binder.execTransact(Binder.java:1123)
m broadcast -a android.intent.action.BOOT_COMPLETED <
Broadcasting: Intent { act=android.intent.action.BOOT_COMPLETED flg=0x400000 }

Exception occurred while executing 'broadcast':
java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.BOOT_COMPLETED from pid=6014, uid=2000
at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:16069)
at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:15927)
at com.android.server.am.ActivityManagerService.broadcastIntentWithFeature(ActivityManagerService.java:16741)
at com.android.server.am.ActivityManagerShellCommand.runSendBroadcast(ActivityManagerShellCommand.java:746)
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:198)
at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98)
at android.os.ShellCommand.exec(ShellCommand.java:44)
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:10514)
at android.os.Binder.shellCommand(Binder.java:929)
at android.os.Binder.onTransact(Binder.java:813)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:5053)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2875)
at android.os.Binder.execTransactInternal(Binder.java:1159)
at android.os.Binder.execTransact(Binder.java:1123)
tent.action.BOOT_COMPLETED com.example.my_application <
Broadcasting: Intent { act=android.intent.action.BOOT_COMPLETED flg=0x400000 pkg=com.example.my_application }

Exception occurred while executing 'broadcast':
java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.BOOT_COMPLETED from pid=6018, uid=2000
at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:16069)
at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:15927)
at com.android.server.am.ActivityManagerService.broadcastIntentWithFeature(ActivityManagerService.java:16741)
at com.android.server.am.ActivityManagerShellCommand.runSendBroadcast(ActivityManagerShellCommand.java:746)
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:198)
at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98)
at android.os.ShellCommand.exec(ShellCommand.java:44)
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:10514)
at android.os.Binder.shellCommand(Binder.java:929)
at android.os.Binder.onTransact(Binder.java:813)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:5053)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2875)
at android.os.Binder.execTransactInternal(Binder.java:1159)
at android.os.Binder.execTransact(Binder.java:1123)
tent.action.BOOT_COMPLETED com.example.my_application <
Broadcasting: Intent { act=android.intent.action.BOOT_COMPLETED flg=0x400000 pkg=com.example.my_application }

Exception occurred while executing 'broadcast':
java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.BOOT_COMPLETED from pid=6026, uid=2000
at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:16069)
at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:15927)
at com.android.server.am.ActivityManagerService.broadcastIntentWithFeature(ActivityManagerService.java:16741)
at com.android.server.am.ActivityManagerShellCommand.runSendBroadcast(ActivityManagerShellCommand.java:746)
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:198)
at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98)
at android.os.ShellCommand.exec(ShellCommand.java:44)
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:10514)
at android.os.Binder.shellCommand(Binder.java:929)
at android.os.Binder.onTransact(Binder.java:813)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:5053)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2875)
at android.os.Binder.execTransactInternal(Binder.java:1159)
at android.os.Binder.execTransact(Binder.java:1123)

Как мне получить разрешение на получение сообщение конца загрузки?
  • Вопрос задан
  • 121 просмотр
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы