If adb command works, and adb tcp/ip is enabled on your TV then another way to make it work is using adb on your androidTV instead of adb on computer.Did you ever find a solution to this "toybox: Unknown command am" error when running am command?
Hi @flar2
I was trying to launch an activity using ButtonMapper Pro ut I can't make it work. Here are the things I've tried.
1. Used Shell command: am start -n "com.android.tv.settings/.<ActivityHere>"
But I was getting the toast "toybox: Unknown command am"
2. Used Shell command: adb shell am start -n "com.android.tv.settings/.<ActivityHere>"
But I was getting the toast "toybox: Unknown command adb"
3. I tried to broadcast the Intent with action "com.android.tv.settings.<ACTIVITY>" and checked the option to launch as activity but nothing happens
4. I tried to broadcast the Intent with action "com.android.tv.settings/.<ACTIVITY>" and checked the option to launch as activity but I was getting the toast "Not available"
I tried attempts 3 and 4 again as package and component values but I just get the same result.
Is there any documentation with examples on how to use the Shell and Broadcast Intent options? I tried looking it up but I had no luck.
When I connected my PC to the TV via adb shell, I was able to run the am start command it launches the activity.
But when I run the same shell command via ButtonMapper I get "toybox: Unknown command am"
Thanks!
EDIT:
I tried to call /system/bin/am instead but it gives me an error asking for the permission android.permission.INTERACT_ACROSS_USERS_FULL
EDIT2:
On getting "toybox: Unknown command am", it's weird because am is not under toybox. It's just android built in binary. Why does ButtonMapper think I was invoking toybox? I looked up toybox and it turns out it a port of unix tools to android like busybox.
Can confirm that /system/bin/am exists. I wonder why ButtonMapper can't invoke the am binary. Maybe ButtonMapper can only invoke unix tool binaries under toybox? I haven't tried but maybe Button Mapper can't invoke pm either. I'll try when I get the chance.
EDIT3:
I tried an app called Activity Launcher and it can launch the activity that I wanted. I am not and Android developer so I have no idea how to figure out how Activity Launcer is doing it. Is it invoking shell command and calling the android am (activity manager)? Or is it firing Intents?
Maybe they right option to use in Button Mapper is the Broadcast Intent but I just can't find a guide on how to use it.
From androidTV:
adb connect $androidTV_IP
adb -s $androidTV_IP shell...