I have been playing around with Androids ASE(android scripting environment). ASE allows you to run scripts on your android powered device. You can use Python, PHP, Javascript, Pearl, Ruby and much more. To install ASE on your device you must either have root, allow third party apps install,, or know how to sideload apk’s using android’s SDK tools like adb.
You can find the apk along with install instructions and more info on ASE at their website.
Here is an example of using python as a remote spycam. I am using the Twisted Framework as the server, and it gets interesting because I embed the captured image from the phone as base64 data on the webpage Twisted is serving up. You can choose to install the Twisted libs when you install python on your device. This is a fairly new feature.
To learn more about twisted, you can visit their website.
import android, os, base64 from twisted.internet import protocol, reactor droid = android.Android() os.chdir('/sdcard/webserver/') def imgb64(): droid.cameraCapturePicture('/sdcard/webserver/latest.jpg', True) im = open("latest.jpg","rb") ime = base64.b64encode(im.read()) im.close() os.remove("latest.jpg") return ime class ServeImage(protocol.Protocol): def connectionMade(self): data = imgb64() self.transport.write("""<html><head><title>Android Camera</title></head><body><img src="data:image/jpg;base64,%s" alt="image"/>test</body></html>""" % data) self.transport.loseConnection() class ServeImageFactory(protocol.ServerFactory): protocol = ServeImage reactor.listenTCP(8080, ServeImageFactory()) reactor.run()
your cool man, i think its java code right? I’m newbie in sl4a, is the programming support an intellisense? is it okay if you can sent me the .apk’s i cant find apk for java language to use in sl4a, engr_larion@yahoo.com.ph thank you.
It is in Python not Java. SL4A is a scripting layer to the android OS. You can use a lot of scripting languages such as Lua, PHP, and Python.
Android apps are developed in Java. You need to look into the Android SDK and develop native apps if Java is your language of choice.
Seriously Why did u say it is Java?
I was reading your “About Me” and got quite imperresed. The way you have learned things without going to school.
Thanks K.B for sharing the code.
Hi Tech B, How can I call this server from another device?