exec命令Android原生code [英] exec command android native code
问题描述
我试图发起从本地code的Android应用程序。
I am trying to launch an android applications from native code.
在亚洲开发银行的外壳,我们可以通过启动应用程序是命令。
In adb shell we can launch applications using "am" command.
链接:
<一个href="http://stackoverflow.com/questions/6109234/how-to-runnot-only-install-an-android-application-using-apk-file">How使用的.apk文件运行(不只是安装)Android应用程序?
有没有办法来调用这个我,通过C code命令?
Is there any way to invoke this "am" command through C code?
我尝试了以下线,但EXEC将返回-1:
I tried the following line but exec is returning -1:
ret = execl("/system/bin/am", "start", "-a", "android.intent.action.MAIN",
"-n", "com.android.settings/.Settings", (char *)NULL);
这是正确与否?
Is this right or not?
推荐答案
我得到了答案...... 我exec'ed壳本身并赋予它命令它的工作
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);
由于m0skit0,帕德玛·库马尔,尤里......
Thanks to m0skit0, Padma Kumar, Yuri ...
这篇关于exec命令Android原生code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!