S
S
Sebastian Pereira2014-08-08 15:10:54
linux
Sebastian Pereira, 2014-08-08 15:10:54

Android: how to run application from command line?

Hello.
There is a script that I run at system startup:

prevconfig=$(getprop sys.usb.config)
if [ "${prevconfig}" != "${prevconfig#rndis}" ] ; then	
  echo 'Bla bla' >&2		 
  exit 1
fi

If there is a usb connection, then we display a message - okay, understandable.
Now I need to add in addition to the message "bla bla" Launching the application:
am start -n my.package.name/.MyActivityName
through the terminal emulator - everything starts. But if I add this to the script above, I get:
am: not found.
I understand that the shell does not yet know such a command at startup.
Tell me how I can change the first script so that it also launches the application.
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex Z., 2014-08-08
@shumaher86

add LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/system/libabove

A
Andrey Burov, 2014-08-08
@BuriK666

Specify the full path to am.
You can find it in the terminal
which am

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question