Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Launching Terminal Emulator for Android from another App
Clone this wiki locally
Terminal Emulator for Android can be launched programmatically from another Android application using the standard Android Intent mechanism. You can optionally supply an intent extra to specify an initial command to be passed to the terminal emulator.
- jackpal.androidterm.OPEN_NEW_WINDOW opens a new terminal window. No script execution is allowed, and no permissions are required to use this action.
- jackpal.androidterm.RUN_SCRIPT opens a new window and runs the script specified in the jackpal.androidterm.iInitialCommand extra. Applications using this intent must have the jackpal.androidterm.permission.RUN_SCRIPT permission, which must be approved by the user at install time.
// opens a new window Intent i = new Intent("jackpal.androidterm.OPEN_NEW_WINDOW"); i.addCategory(Intent.CATEGORY_DEFAULT); startActivity(i); // opens a new window and runs "echo 'Hi there!'" // application must declare jackpal.androidterm.permission.RUN_SCRIPT in manifest Intent i = new Intent("jackpal.androidterm.RUN_SCRIPT"); i.addCategory(Intent.CATEGORY_DEFAULT); i.putExtra("jackpal.androidterm.iInitialCommand", "echo 'Hi there!'"); startActivity(i);
There's an example application showing how to use these intents here: