Skip to content Skip to sidebar Skip to footer

Exec Command Android Native Code

I am trying to launch an android applications from native code. In adb shell we can launch applications using 'am' command. Link: How to run (not only install) an android applicati

Solution 1:

I got the answer... I 'exec'ed the shell itself and gave it the command... It worked

ret = execl("/system/bin/sh", "sh", "-c", "am start -a android.intent.action.MAIN -n   com.android.browser/.BrowserActivity", (char *)NULL);

Thanks to m0skit0, Padma Kumar, Yuri ...

Solution 2:

you should use system() family method ,first it will fork child process and invoke shell then return,so it will not block android main thread

Post a Comment for "Exec Command Android Native Code"