Continue my previous question, I succeeded to execute a process from an Android application. Now I can see two process like I wanted, they both up and running. Now I need to execute an Android application from the native C code.
Found similar questions (1, 2), but the following solutions did NOT work for me.
1. execl("/system/bin/sh", "sh", "-c", "am start -a android.intent.action.MAIN -n com.android.browser/.BrowserActivity", (char *)NULL);
2. execl("/system/bin/am", "start", "-a", "android.intent.action.MAIN",
"-n", "com.android.settings/.Settings", (char *)NULL);
None of the lines above didn't executed anything.
Even executing execl
command with fork
as follows did NOT help.
if (!fork()) {
execl...
}
Can you please give me some kind of a clue? Thanks.
UPDATE: I've manage to print the stdout to the Android log, I'm getting errno
"Exec format error"
message from the execl method. Anybody have an idea how I can resolve this?