2014년 11월 30일 일요일

ActivityStarter Issues....jackpal.androidterm


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,

--
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

--
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???

--
please follow the documentation EXACTLY, see also my screenshot
https://github.com/jackpal/Android-Terminal-Emulator/wiki/Launching-Terminal-Emulator-for-Android-from-another-App
as you can see, there is no package and no class necessary

--
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);
--
and should I change anything in my AI2 (Design or Blocks)???

--
just use the blocks from my screenhot...

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

--
I now prepared a snippet, for details see here https://puravidaapps.com/snippets.php#2terminal

--

댓글 없음:

댓글 쓰기