damonkohler / sl4a

SL4A brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device.
Apache License 2.0
2.42k stars 803 forks source link

Able to run Python Script(or packaged APK file) when reboot #140

Open damonkohler opened 9 years ago

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

What should be supported?

Able to run Python Script(or packaged APK file) automatically after reboot.

Original issue reported on code.google.com by mike...@gmail.com on 31 Aug 2011 at 3:05

Copied from original issue: damonkohler/android-scripting#564

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

This has the capability of going horribly wrong.
However, I believe there are other apps on the market (Tasker? Locale?) which 
can trigger on boot.
See the Remote Control page on the wiki for how to start sl4a scripts from 
another app.

Original comment by rjmatthews62 on 31 Aug 2011 at 3:28

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

Android Java API able to do that.

BlackBerry API also able to do that.

More feature always better.

Original comment by mike...@gmail.com on 31 Aug 2011 at 3:46

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

Here is the reason why I need run Python Script automatically after reboot:
2 Projects:
1. Auto-Pilot for hobby helicopter, I want to open the phone, 
   take out the mainboard and use it only,
   without the LCD of the phone,consume less power and weight less.
2. High-Altitude balloon camera, upload pictures automatically to cloud.
   Same thing, use only the mainboard, light and use less battery.

If you open the phone, you will see how small and light the mainboard.

Original comment by mike...@gmail.com on 1 Sep 2011 at 12:31

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

I don't see much reason to add this to SL4A, since there are already several 
ways to accomplish this.

Tasker[1] can definitely start SL4A scripts when the system boots. Locale might 
be able to as well, but I don't have it installed at the moment to check. If 
you don't want to use Tasker or Locale, you could write a regular Android app 
that starts on boot and runs your script.[2] You could also root the phone and 
use standard linux tools to run your script on boot.

[1]: http://tasker.dinglisch.net/
[2]: 
http://code.google.com/p/android-scripting/wiki/FAQ#Can_I_run_an_SL4A_script_fro
m_my_application?

Original comment by barbaraj...@gmail.com on 1 Sep 2011 at 1:47

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

[deleted comment]
damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

Right! I can root the phone and put in init.rc 

But how can I run Python script from Linux command line?
After I did some research, I am able to run python after I SSH to the phone.
But when I tried to run my script,is says:
dlopen libpython2.6.so
Traceback (most recent call last):
  File "compass.py", line 2, in <module>
    droid = android.Android()
  File "/sdcard/com.googlecode.pythonforandroid/extras/python/android.py", line 34, in __init__
    self.conn = socket.create_connection(addr)
  File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/lib/python2.6/socket.py", line 498, in create_connection
socket.gaierror: [Errno 8] hostname nor servname provided, or not known.

Original comment by mike...@gmail.com on 1 Sep 2011 at 3:14

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

"But how can I run Python script from Linux command line?
After I did some research, I am able to run python after I SSH to the phone.
But when I tried to run my script,is says:
dlopen libpython2.6.so
Traceback (most recent call last):
  File "compass.py", line 2, in <module>
    droid = android.Android()
  File "/sdcard/com.googlecode.pythonforandroid/extras/python/android.py", line 34, in __init__
    self.conn = socket.create_connection(addr)
  File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/lib/python2.6/socket.py", line 498, in create_connection
socket.gaierror: [Errno 8] hostname nor servname provided, or not known."

Exact same problem here...
Any hints?

Original comment by d.nas...@gmail.com on 31 Mar 2012 at 5:08