Android

I loves my Android phone, I do.

So, here's a special little area to list the things I've written for it.


Barcamp Brighton 4 slides

Here is the OpenOffice presentation that I gave at BCB4 in September 2009. Also available as a PDF, or on Slideshare:

Introduction to Android development
View more presentations from tristanr.

Alphanumeracy

Version 0.1 July 2009

Here's a simple app to use with your child while they are learning the alphabet. Letters or numbers bounce round the screen, and the idea is that the child shouts out their name. Tapping the screen selects a new letter/number. Shaking or tilting the phone bounces it around more (the phone vibrates when a number hits the edge - parents can amuse themselves by trying to stop this happening). Pressing menu allows you to select the letters or numbers you want to display.

To use it, click to launch the installer, or scan the QR code below. This app is heavily based on Eric Burke's bouncing ball demo - email me if you'd like a copy of the source code.

TODO: improve edge alignment; reinstate varied colours; add option to turn off vibration


webserver.py

July 2009

Here's a simple script to share the contents of your SD card over the web. Just run it, find out the IP address of your phone (under WiFi settings) and connect to http://:8000/ to see all your files. I can't claim any credit for this as it's something I spotted on the Android Google Group, but I just thought it was a nice hack!

To use it, install Android Scripting Environment, and then copy-paste the code below (or from the standalone page, or via the QR code below). Tip: press more->Select text while in the browser, then MENU+V to paste in the ASE editor.


"""webserver.py - show the contents of your SD card at http://your phone's IP address:8000/
tristan@roddis.org July 2009"""

import SimpleHTTPServer
from os import chdir

chdir('/sdcard/')

SimpleHTTPServer.test()


txtmylocation.py

June 2009

When I used to commute, please would always call home and say "I'm on the train". This script is designed to stop inflicting that on fellow passengers, by providing a single-touch way of sending a text to your loved one that tells them your current location.

To use it, install Android Scripting Environment, and then copy-paste the code below (or from the standalone page, or via the QR code below). Tip: press more->Select text while in the browser, then MENU+V to paste in the ASE editor.


"""A simple Python module to text your last known location to the telephone number specified in TO. 
Uses the Google Maps reverse geocoder to convert lat/lon to place names. 
tristan@roddis.org June 2009"""

import android
import json
import urllib2

FROM = 'YOUR NAME'
TO = 'RECIPIENT TELEPHONE NUMBER'

GEOCODER_URL = 'http://maps.google.com/maps/geo?'

droid = android.Android()

location = droid.getLastKnownLocation()['result']

url = GEOCODER_URL + 'q=%s,%s' % (location['latitude'], location['longitude'])
data = urllib2.urlopen(url).read()
result = json.loads(data, encoding='iso-8859-1')
#print result

if result['Status']['code'] == 200:
  place = result['Placemark'][0]['address']
else:
  place = 'an unknown location'

droid.sendTextMessage(TO, "%s is at %s" % (FROM, place))

droid.makeToast("Message sent to %s telling them you are at %s" % (TO, place) )
droid.exit()

Home
C.V.
Contact
Availability
Misc.