Open GoogleCodeExporter opened 9 years ago
Original comment by rjmatthews62
on 25 Mar 2011 at 1:05
I also encounter the same problem. See my activity, script, and logcat output
below.
Activity:
package com.madc.sl4atest;
import java.io.*;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import com.googlecode.android_scripting.Constants;
import com.googlecode.android_scripting.IntentBuilders;
public class TestActivity extends Activity {
public static final int TOUCHNNDECODE = 7;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// in case you have created a separate IntentBuilders.java file
// Intent intent = IntentBuilders.buildStartInTerminalIntent(new File("/sdcard/sl4a/scripts/say_time.py"));
// else use this one
Intent intent = IntentBuilders.buildStartInBackgroundIntent(new File(Environment.getExternalStorageDirectory(), "sl4a/scripts/test_migs.py"));
intent.putExtra("in", "TouchNN");
Log.d("SL4ATest", "The intent is " + intent.toString());
startActivityForResult(intent, TOUCHNNDECODE);
} // onCreate
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch(requestCode){
case TOUCHNNDECODE:
if(data == null)
Log.d("SL4ATest", "Python reply -> NULL");
else
Log.d("SL4ATest", "Python reply -> " + data.toString());
break;
}
}
}
Python Script:
import android,time
droid = android.Android()
mIntent = droid.getIntent().result
Extras = mIntent["extras"]
Input = Extras["in"]
droid.makeToast('Hello' + Input + 'from Python!')
droid.vibrate(300)
Result_OK = -1
resultData = "Returned from SL4a Script!"
droid.setResultString(Result_OK, resultData)
Logcat:
V/sl4a.SimpleServer:225(25766): Bound to localhost/127.0.0.1
V/sl4a.Process:115(25766): Executing
/data/data/com.googlecode.pythonforandroid/files/python/bin/python with a
rguments [/mnt/sdcard/sl4a/scripts/test_migs.py] and with environment
{ANDROID_SOCKET_zygote=10, AP_HANDSHAKE=
85c513bf-c7e6-40a7-a28d-bf95233ebd7d, ANDROID_BOOTLOGO=1,
EXTERNAL_STORAGE=/mnt/sdcard, ANDROID_ASSETS=/system
/app, PY4A_EXTRAS=/mnt/sdcard/com.googlecode.pythonforandroid/extras/,
PATH=/sbin:/vendor/bin:/system/sbin:/sy
stem/bin:/system/xbin, ASEC_MOUNTPOINT=/mnt/asec,
PYTHONPATH=/mnt/sdcard/com.googlecode.pythonforandroid/extra
s/python:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/l
ib-dynload:/data/data/com.goog
lecode.pythonforandroid/files/python/lib/python2.6, AP_HOST=127.0.0.1,
LOOP_MOUNTPOINT=/mnt/obb, TEMP=/mnt/sdc
ard/com.googlecode.pythonforandroid/extras/python/tmp,
BOOTCLASSPATH=/system/framework/core.jar:/system/framew
ork/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/
system/framework/android.polic
y.jar:/system/framework/services.jar:/system/framework/core-junit.jar:/system/fr
amework/com.htc.commonctrl.jar
:/system/framework/com.htc.framework.jar:/system/framework/com.htc.android.pimli
b.jar:/system/framework/com.ht
c.android.easopen.jar:/system/framework/com.scalado.util.ScaladoUtil.jar:/system
/framework/com.orange.authenti
cation.simcard.jar:/system/framework/android.supl.jar:/system/framework/com.ecri
o.sip.jar, AP_PORT=38736, ANDR
OID_DATA=/data,
PYTHONHOME=/data/data/com.googlecode.pythonforandroid/files/python,
LD_LIBRARY_PATH=/data/data
/com.googlecode.pythonforandroid/files/python/lib, ANDROID_ROOT=/system,
ANDROID_PROPERTY_WORKSPACE=9,65536}
D/SL4ATest(26655): Python reply -> NULL
D/ActivityManager( 1378): destroyActivityLocked, r=HistoryRecord{40b27fb0
com.googlecode.android_scripting/.ac
tivity.ScriptingLayerServiceLauncher}
V/ActivityManager( 1378): destroyActivityLocked,
dalvik.system.VMStack.getThreadStackTrace(Native Method)
V/ActivityManager( 1378): destroyActivityLocked,
java.lang.Thread.getStackTrace(Thread.java:745)
V/ActivityManager( 1378): destroyActivityLocked,
com.android.server.am.ActivityStack.destroyActivityLocked(Act
ivityStack.java:3332)
V/ActivityManager( 1378): destroyActivityLocked,
com.android.server.am.ActivityStack.activityIdleInternal(Acti
vityStack.java:3010)
V/ActivityManager( 1378): destroyActivityLocked,
com.android.server.am.ActivityManagerService.activityIdle(Act
ivityManagerService.java:4410)
V/ActivityManager( 1378): destroyActivityLocked,
android.app.ActivityManagerNative.onTransact(ActivityManagerN
ative.java:371)
V/ActivityManager( 1378): destroyActivityLocked,
com.android.server.am.ActivityManagerService.onTransact(Activ
ityManagerService.java:1642)
V/ActivityManager( 1378): destroyActivityLocked,
android.os.Binder.execTransact(Binder.java:320)
V/ActivityManager( 1378): destroyActivityLocked,
dalvik.system.NativeStart.run(Native Method)
D/WindowManagerImpl( 1378): finishRemoveViewLocked, mViews[1]:
com.android.internal.policy.impl.PhoneWindow$De
corView@40e99ea8
D/StatusBarPolicy( 1536): Network Type: 8
V/sl4a.SimpleServer$ConnectionThread:89(25766): Server thread 39 started.
D/dalvikvm(25766): GC_CONCURRENT freed 433K, 48% free 3212K/6151K, external
0K/0K, paused 2ms+3ms
D/dalvikvm(25766): GC_CONCURRENT freed 484K, 48% free 3239K/6151K, external
0K/0K, paused 2ms+3ms
V/sl4a.JsonRpcServer:74(25766): Received: {"params":
["85c513bf-c7e6-40a7-a28d-bf95233ebd7d"], "id": 0, "metho
d": "_authenticate"}
V/sl4a.JsonRpcServer:117(25766): Sent: {"error":null,"id":0,"result":true}
V/sl4a.JsonRpcServer:74(25766): Received: {"params": [], "id": 1, "method":
"getIntent"}
V/sl4a.JsonRpcServer:117(25766): Sent:
{"error":null,"id":1,"result":{"action":"com.googlecode.android_scripti
ng.action.LAUNCH_BACKGROUND_SCRIPT","categories":null,"flags":0,"classname":"com
.googlecode.android_scripting.
activity.ScriptingLayerService","packagename":"com.googlecode.android_scripting"
,"extras":{"com.googlecode.and
roid_scripting.extra.SCRIPT_PATH":"\/mnt\/sdcard\/sl4a\/scripts\/test_migs.py","
in":"TouchNN"}}}
V/sl4a.JsonRpcServer:74(25766): Received: {"params": ["HelloTouchNNfrom
Python!"], "id": 2, "method": "makeToa
st"}
V/sl4a.JsonRpcServer:117(25766): Sent: {"error":null,"id":2,"result":null}
V/sl4a.JsonRpcServer:74(25766): Received: {"params": [300], "id": 3, "method":
"vibrate"}
D/WindowManagerImpl(25766): addView, new view, mViews[0]:
android.widget.LinearLayout@405ac180
V/sl4a.JsonRpcServer:117(25766): Sent: {"error":null,"id":3,"result":null}
V/sl4a.JsonRpcServer:74(25766): Received: {"params": [-1, "Returned from SL4a
Script!"], "id": 4, "method": "s
etResultString"}
V/sl4a.JsonRpcServer:117(25766): Sent: {"error":null,"id":4,"result":null}
V/sl4a.SimpleServer$ConnectionThread:100(25766): Server thread 39 died.
V/sl4a.Process$1:135(25766): Process 27915 exited with result code 0.
I/keystore( 1271): uid: 1000 action: e -> 7 state: 2 -> 2 retry: 4
D/lights ( 1378): [LedInfo] write attr ok
name=/sys/class/leds/green/brightness string=1,len=1
Original comment by migscab...@gmail.com
on 22 Mar 2013 at 7:03
Original issue reported on code.google.com by
SofianeM...@gmail.com
on 24 Mar 2011 at 10:15