Closed mshavliuk closed 3 months ago
Another try with [-n <COMPONENT_NAME>]
parameter:
adb shell am broadcast -a com.razeeman.util.simpletimetracker.ACTION_STOP_ALL_ACTIVITIES -n com.razeeman.util.simpletimetracker
# result
Exception occurred while executing 'broadcast':
java.lang.IllegalArgumentException: Bad component name: com.razeeman.util.simpletimetracker
at android.content.Intent.parseCommandArgs(Intent.java:8236)
at com.android.server.am.ActivityManagerShellCommand.makeIntent(ActivityManagerShellCommand.java:381)
at com.android.server.am.ActivityManagerShellCommand.runSendBroadcast(ActivityManagerShellCommand.java:797)
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:9285)
at android.os.Binder.shellCommand(Binder.java:1049)
at android.os.Binder.onTransact(Binder.java:877)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:4731)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2628)
at android.os.Binder.execTransactInternal(Binder.java:1285)
at android.os.Binder.execTransact(Binder.java:1244)
adb shell am broadcast -a com.razeeman.util.simpletimetracker.ACTION_STOP_ALL_ACTIVITIES -n com.razeeman.util.simpletimetracker/com.example.util.simpletimetracker.feature_notification.recevier.NotificationReceiver
# result
Broadcasting: Intent { act=com.razeeman.util.simpletimetracker.ACTION_STOP_ALL_ACTIVITIES flg=0x400000 cmp=com.razeeman.util.simpletimetracker/com.example.util.simpletimetracker.feature_notification.recevier.NotificationReceiver }
Broadcast completed: result=0
And finally the activity has stopped!
But the problem is that none of the automation apps I've tried so far (Automation, Easer) allow to specifically set the target app for broadcast intent. Any hints how to solve this? Or is it possible to allow the app to respond to a general broadcast without component parameter?
Hello! It should work with specified package. With adb it would look like this:
adb shell am broadcast -a com.razeeman.util.simpletimetracker.ACTION_STOP_ALL_ACTIVITIES com.razeeman.util.simpletimetracker
Automation apps should also support setting a package on broadcasted intent. Not familiar with Automation or Easer but Macrodroid for example has this feature, see #68. Hope this helps!
Probably the issue is resolved. If it is not, please reopen.
Hello, I'm trying to set up the automation feature with the time tracker, but having following issue.
What I do
I send an intent with adb like this:
Meanwhile, in another terminal I run the following command to monitor intents activity:
What I expect
What actually happens
01-24 08:46:13.908 1713 1796 W BroadcastQueue: Background execution not allowed: receiving Intent { act=com.razeeman.util.simpletimetracker.ACTION_STOP_ALL_ACTIVITIES flg=0x400010 } to com.razeeman.util.simpletimetracker/com.example.util.simpletimetracker.feature_notification.recevier.NotificationReceiver
Extra info