Android: How can I guess the correct qualified app name to start some program?

126 views Asked by At

I think the best way to ask this question is via example, so I will use a specific app.

The WebKey app for Android has a option to start on boot that I prefer to keep disabled. But I would like to manually start this program via remote SSH console.

My attemp is this command (that, as can be seen, fails):

root@S3:/ # am start -a android.intent.action.MAIN -n com.webkey/.BootStarter
am start -a android.intent.action.MAIN -n com.webkey/.BootStarter
Starting: Intent { act=android.intent.action.MAIN cmp=com.webkey/.BootStarter }
Error type 3
Error: Activity class {com.webkey/com.webkey.BootStarter} does not exist.

It seems I am not referring the correct class. This is how I found that class:

root@S3:/ # dumpsys package resolvers receiver | awk '/android.intent.action.BOOT_COMPLETED/{p=1;next}/:/{p=0}p {print $2}' | grep webkey
com.webkey/.BootStarter
com.webkey/androidx.work.impl.background.systemalarm.RescheduleReceiver

Actually, I don't even know how to obtain the proper classes to start a program knowing its qualified app name.

I don't know if the problem is in the ADB configuration:

root@S3:/ # adb shell
adb shell
* daemon not running. starting it now on port 5038 *
* daemon started successfully *
error: device not found

Could someone give me any ideas to manually start the correct program, please?

Further notes:

  • All shell tests have been performed as root (su).
  • The device is rooted. Answer for a non-rooted device are welcome too.

NEW TEST:

Same example with TeamViewer Host:

root@S3:/ # dumpsys package resolvers receiver | awk '/android.intent.action.BOOT_COMPLETED/{p=1;next}/:/{p=0}p {print $2}' | grep team -i
com.teamviewer.host.market/com.teamviewer.host.receiver.BootReceiver

But it does not start, neither:

root@S3:/ # am start -n com.teamviewer.host.market/com.teamviewer.host.receiver.BootReceiver
Starting: Intent { cmp=com.teamviewer.host.market/com.teamviewer.host.receiver.BootReceiver }
Error type 3
Error: Activity class {com.teamviewer.host.market/com.teamviewer.host.receiver.BootReceiver} does not exist.
1

There are 1 answers

0
Zoltán Papp On

The BootStarter is an broadcast receiver. So the "am start" command is not correct. You should send broadcast.

am broadcast -a android.intent.action.BOOT_COMPLETED -n com.webkey/com.webkey.BootStarter   

I do not know your real expectations but we have documentation about it how you can control the Webkey. Please check this site: https://github.com/webkeydev/webkey-headless-control

Anyway if you have any question contact me. I am lead developer at Webkey.