Showing posts with label scripting. Show all posts
Showing posts with label scripting. Show all posts

Tuesday, 28 August 2012

Beanshell Android Source Script

Edit: Updated 2014-08-26

Download

For those using SL4A and Beanshell on their Android, one of the things you need to do if you want to access the Android instance is to know the location of the android.bsh script which is included as part of the Beanshell installation.

The script embedded in the above QR code provides a simple way of working out this location without having to hard code it per script, making your scripts much more portable.

Feel free to use this any way you like, and in particular I would be interested to see any further optimisations to this script as the character count matters in a QR Code based scripts.

Monday, 6 February 2012

SL4A Scripting Languages for Android

In my hunt for programming capabilities on the Android, and some playing around with BeanShell I found something that worked very well.

I downloaded SL4A which is a scripting host for Android. It takes a bit of setting up, as you then need to install the BeanShell interpreter. However, from there I was able to automate a question I was wondering about.

The idea is simple, using a specific search term, can I get a feel for how much battery life people get from their handsets?

So after a bit of hacking at the script, I was able to simply searche for the handset name, and "battery lasts x days" where x was iterated.

The result:

HTC Wildfire battery days (1): 58
HTC Wildfire battery days (2): 199
HTC Wildfire battery days (3): 83
HTC Wildfire battery days (4): 8
HTC Desire battery days (1): 71
HTC Desire battery days (2): 943
HTC Desire battery days (3): 422
HTC Desire battery days (4): 7
Nexus One battery days (1): 4
Nexus One battery days (2): 240
Nexus One battery days (3): 444
Nexus One battery days (4): 0
Nexus S battery days (1): 37
Nexus S battery days (2): 237
Nexus S battery days (3): 72
Nexus S battery days (4): 3

My HTC Wildfire gets about 2 days, so that query technique feels like it has turned up some useful data.

And for those interested in the BeanShell script.