Skip to first unread message

Richard Mislan

unread,
Nov 25, 2014, 10:36:35 AM11/25/14
to mitappinv...@googlegroups.com

So, I have been banging my head against the keyboard all weekend on this one...(BTW, not helping...)
I have the following, but can't get it to run the iInitial Command (or script)...what am I missing?

when Button1.LongClick
do
    set ActivityStarter1.Action to "android.intent.action.MAIN"
    set ActivityStarter1.ExtraKey to "jackpal.androidterm.iInitialCommand"
    set ActivityStarter1.ExtraValue to "exec su -c whoami"
    set ActivityStarter1.ActivityPackage to "jackpal.androidterm"
    set ActivityStarter1.ActivityClass to "jackpal.androidterm.Term"
    call ActivityStarter1.StartActivity

I have also tried the following:

when Button1.LongClick
do
    set ActivityStarter1.Action to "android.intent.action.MAIN"
    set ActivityStarter1.ExtraKey to "android.intent.action.RUN_SCRIPT"
    set ActivityStarter1.ExtraValue to "exec sh run.sh"
    set ActivityStarter1.ActivityPackage to "jackpal.androidterm"
    set ActivityStarter1.ActivityClass to "jackpal.androidterm.Term"
    call ActivityStarter1.StartActivity

Thanks much for your time and assistance,
Rick

Taifun

unread,
Nov 25, 2014, 6:24:59 PM11/25/14
to mitappinv...@googlegroups.com
I just tried this, see screenshot



you have to modify the manifest with a third party tool, e.g. AppToMarket to get this running, see also https://github.com/jackpal/Android-Terminal-Emulator/wiki/Launching-Terminal-Emulator-for-Android-from-another-App

Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         



Richard Mislan

unread,
Nov 28, 2014, 8:23:40 AM11/28/14
to mitappinv...@googlegroups.com
Update...still nothing, however I did want to add that I also have the following setup:

On the ActivityButton in the Designer I have set up the following:

*Action:* android.intent.action.MAIN
*ActivityClass:* jackpal.androidterm.Term
*ActivityPackage:* jackpal.androidterm
*ExtraKey:* jackpal.androidterm.iInitialCommand
*ExtraValue:* sh /sdcard/run.sh

As suggested by this link:

I have also now built the button.click to look like this:

when Button.clicked
    set ActivityStarter1.ActivityPackage to "jackpal.androidterm.Term"
    set ActivityStarter1.ActivityClass to "jackpal.androidterm"
    set ActivityStarter1.Action to "jackpal.androidterm.RUN_SCRIPT" 
    set ActivityStarter1.ExtraKey to "jackpal.androidterm.iInitialCommand"
    set ActivityStarter1.ExtraValue to "sh sdcard/run.sh"
if is empty call ActivityStarter1.ResolveActivity
then call notifier show 
             notice "ALERT!"
else 
    call ActivityStarter1.StartActivity

And I have edited the AndroidManifest.xml with the AppToMarket tool to now include: 
<uses-permission android:name="jackpal.androidterm.RUN_SCRIPT"/>

which upon the .apk install where it asks for permissions...does not ask for anything like running scripts... 

So, when I press the button, my app launches the Android Terminal, but just shows the command line with no command issued...frustrating...

I guess, I'm not sure if I'm missing something or where each item for ActivityStarter is supposed to go... 
I think that is adding to the confusion and the inability for it to work...

Any other suggestions???

Thanks much,
Rick

Taifun

unread,
Nov 28, 2014, 9:07:31 AM11/28/14
to mitappinv...@googlegroups.com
please follow the documentation EXACTLY, see also my screenshot

Richard Mislan

unread,
Nov 28, 2014, 9:14:57 AM11/28/14
to mitappinv...@googlegroups.com
So, just to be clear...
I need to type in all of this into the manifest....EXACTLY...(except, of course, my own initial command...)


// 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);

Richard Mislan

unread,
Nov 28, 2014, 9:15:55 AM11/28/14
to mitappinv...@googlegroups.com
and should I change anything in my AI2 (Design or Blocks)???


Thanks much!
Rick

Taifun

unread,
Nov 28, 2014, 9:17:13 AM11/28/14
to mitappinv...@googlegroups.com
just use the blocks from my screenhot...
Taifun

Taifun

unread,
Nov 28, 2014, 4:02:39 PM11/28/14
to mitappinv...@googlegroups.com
I now prepared a snippet, for details see here https://puravidaapps.com/snippets.php#2terminal
Taifun
Reply all
Reply to author
Forward
0 new messages