broadcast permission

Hello, This question is related to the tutorial below.

H/W information

  • Galaxy Watch 5 Pro (SM-R920)

S/W information :

  • One UI Watch : 5.0
  • Software : R920XXU1BWH3 / SM-R920NZTAKOO
  • System : 13
  • Wear OS : 4.0
  • API : 33

I want to manually override the off-body sensor, so I enter the command.

$ adb shell am broadcast -a com.samsung.android.hardware.sensormanager.service.OFFBODY_DETECTOR --ei force_set 1

but the terminal prints the message below.

PS C:\Users\5900X\AndroidStudioProjects\MyApplication> adb shell am broadcast -a com.samsung.android.hardware.sensormanager.service.OFFBODY_DETECTOR --ei force_set 1
Broadcasting: Intent { act=com.samsung.android.hardware.sensormanager.service.OFFBODY_DETECTOR flg=0x400000 (has extras) }

Exception occurred while executing 'broadcast':
java.lang.SecurityException: Permission Denial: not allowed to send broadcast com.samsung.android.hardware.sensormanager.service.OFFBODY_DETECTOR from pid=28667, uid=2000
        at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:14286)
        at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:14124)
        at com.android.server.am.ActivityManagerService.broadcastIntentWithFeature(ActivityManagerService.java:15022)
        at com.android.server.am.ActivityManagerShellCommand.runSendBroadcast(ActivityManagerShellCommand.java:806)
        at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:221)
        at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
        at android.os.ShellCommand.exec(ShellCommand.java:38)
        at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:9653)
        at android.os.Binder.shellCommand(Binder.java:1049)
        at android.os.Binder.onTransact(Binder.java:877)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:4824)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2753)
        at android.os.Binder.execTransactInternal(Binder.java:1285)
        at android.os.Binder.execTransact(Binder.java:1244)

I think I don’t have permission to broadcast.
What should I do to solve this problem?

Note : I successfully executed the command at the other watch 5 pro.
but that watch differs from one which I first mentioned in S/W information.

S/W information :

  • One UI Watch : 4.5
  • Software : R920XXU1AWD6 / SM-R920NZKAKOO
  • System : 11
  • Wear OS : 3.5
  • API : 30

One watch was updated to Wear4 and the tutorial and other watch was still at Wear 3.x

I would suggest you open a developer support request and ask for Shamima about this, she is in Developer Support and wrote that blog.

Ron
Samsung Developer Relations