Open Source at Google | Android Scripting Environment is noy open

By Akram on 8:25:00 AM

Filed Under:

The Android Scripting Environment (ASE) brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device. These scripts have access to many of the APIs available to full-fledged Android applications, but with a greatly simplified interface that makes it easy to:



  • Handle intents

  • Start activities

  • Make phone calls

  • Send text messages

  • Scan bar codes

  • Poll location and sensor data

  • Use text-to-speech (TTS)

  • And more




Scripts can be run interactively in a terminal, started as a long running service, or started via Locale. Python, Lua and BeanShell are currently supported, and we're planning to add Ruby and JavaScript support, as well.





Scripts can be edited directly on the phone.





The script manager displays available scripts.









Scripts can be launched interactively or as background services.







Interactive terminals can be started for interpreters that support it.







Scripts can use the Android UI to get user input.



You may ask, why write scripts instead of real Android applications? Admittedly, Android's development environment makes life pretty easy, but you're tied to a computer to do your work. ASE lets you develop on the device itself using high-level scripting languages to try out your idea now, in the situation where you need it, quickly. Have a look at the following example Lua script to see for yourself:

--Placing the phone face down will disable the ringer. Turning it face up again will enable
--the ringer.
require "android"
android.startSensing()
android.sleep(1) --Give the sensors a moment to come online.
silent = false
while true do
s = android.readSensors()
facedown = s.result and s.result.zforce and s.result.zforce > 9
if facedown and not silent then
android.vibrate() --A short vibration to indicate we're in silent mode.
android.setRingerSilent(true)
silent = true
elseif not facedown and silent then
android.setRingerSilent(false)
silent = false
end
android.sleep(1)
end


Here's another useful script, this time in Python.

"""Say chat messages aloud as they are received."""

import android, xmpp

_SERVER = 'talk.google.com', 5223

class SayChat(object):
def __init__(self):
self.droid = android.Android()
username = self.droid.getInput('Username')['result']
password = self.droid.getInput('Password')['result']
jid = xmpp.protocol.JID(username)
self.client = xmpp.Client(jid.getDomain(), debug=[])
self.client.connect(server=_SERVER)
self.client.RegisterHandler('message', self.message_cb)
if not self.client:
print 'Connection failed!'
return
auth = self.client.auth(jid.getNode(), password, 'botty')
if not auth:
print 'Authentication failed!'
return
self.client.sendInitPresence()

def message_cb(self, session, message):
jid = xmpp.protocol.JID(message.getFrom())
username = jid.getNode()
text = message.getBody()
self.droid.speak('%s says %s' % (username, text))

def run(self):
try:
while True:
self.client.Process(1)
except KeyboardInterrupt:
pass

saychat = SayChat()
saychat.run()



These scripts demonstrates several of the available APIs available for both Lua and Python. It is intended to be run as a service and silences the ringer when the phone is placed face down. For some scripting languages, like BeanShell, it's possible to access Android's Java API directly. To simplify things, ASE provides the AndroidFacade class. For other languages, like Python and Lua, the API is made available via JSON RPC calls to a proxy. Naturally this means that only the part of the API which has been wrapped by the AndroidFacade and AndroidProxy are available to cross-compiled interpreters like Python and Lua. Thankfully, both AndroidFacade and AndroidProxy are simple to extend.



If you'd like to give ASE a try, it's not yet published to the Market, but will be soon. You can download the latest APK from our project page. Some sample scripts and documentation are also included there to help you get started. We always love to hear what you think, so please send us feedback or ask your questions in the ASE discussion group.

10 comments for this post

Anonymous
Posted on July 9, 2009 7:28 AM  
Anonymous

how hacking hotmail? Dont worry, this rayahari.com does not ask you any information about you. They ask you only to provide nick name when you fill out the request form. They were fast and amazing and you got the information how to hack hotmail free that was needed. Thank so much !



http://www.activehackers.com/msn-hack-software-password.php



facebook mail account hacking profile - yahoo messenger password hack

i want to go without entering the e-mail password yahoo - how to hack into hotmail account 2009



Paula Robinson, Lincoln


England

Posted on July 13, 2009 9:42 AM  
Anonymous
Posted on July 13, 2009 2:24 PM  
Anonymous
Posted on July 15, 2009 10:39 AM  
Anonymous
Posted on July 17, 2009 1:39 PM  
Anonymous

Wanting to know your (boy) girlfriend email password? Yahoo Gmail Hotmail AOL ? Check this out --> how to hack someones Hotmail

hack MSN passwords

how to hack into someones Hotmail

Posted on July 20, 2009 2:14 PM  
Anonymous

Do you know hack into facebook account? This was a fantastic service from http://www.rayahari.com/hack-Facebook-passwords.php. So fast and they delivered exactly what they promised. I would definitely use them again. Thoroughly recommend. Thank for RayaHari.com extremely professional. Efficient and accurate service. I look forward to using your services again in the very near future. facebook hacking password You Can Do This In Five Minutes.



BTW, I found another website that can hack yahoo passwords and other one specialized in hack into hotmail passwords.



Diane Calhoun, Lincoln


England

Posted on July 24, 2009 6:48 AM  
Anonymous

http://www.activehacker.info/how-to-hack-yahoo-password.php - I have only been using this for a few weeks, but so far this is the best hacking place that I have used, they know how to hack hotmail , they are not only is extremely helpful, but who also seems to genuinely care. I would highly recommend ActiveHackers.com to anyone!

I love ActiveHackers.com. Not only is it a fantastic deal but the staff are incredibly helpful and respond to any questions/requests extremely quickly. I would recommend this service to anyone looking for hack into hotmail account.

BTW, I found another website that can hack into someones yahoo passwords and other one specialized in hack hotmail passwords.

Michael Bellamy, Lincoln

England

Posted on December 9, 2009 1:06 PM  
Anonymous

http://www.activehacker.org/how-to-hack-hotmail -password.php is excellent about crack hotmail password! Great ! I will gladly give ActiveHackers.com my business in the future as well as tell others about their service. I was afraid the entire time that this was a scam, but right now I'm very satisfied with their help. I've not ever used hack a hotmail account, but I read somewhere on the internet about ActiveHackers.com. I think they are $200.00. I tried them to hack into my girl hotmail password. wow, I got the password 2 days after my order. ActiveHackers.com is very useful.

BTW, I found another website that can hack into someones yahoo passwords and other one specialized in hack hotmail passwords.

Michael Bellamy, Lincoln

England

Posted on December 11, 2009 3:52 PM  
Anonymous

http://www.activehacker.org/how-to-hack-hotmail -password.php - I have only been using this for a few weeks, but so far this is the best hacking place that I have used, they know crack hotmail password , they are not only is extremely helpful, but who also seems to genuinely care. I would highly recommend ActiveHackers.com to anyone!

I love ActiveHackers.com. Not only is it a fantastic deal but the staff are incredibly helpful and respond to any questions/requests extremely quickly. I would recommend this service to anyone looking for hack a hotmail account.

BTW, I found another website that can hack into someones yahoo passwords and other one specialized in hack hotmail passwords.

Michael Bellamy, Lincoln

England

Posted on December 11, 2009 3:54 PM