# ASE (http://code.google.com/p/android-scripting/) script that replaces # Locator (http://www.viking.tm/product.php?id=11) # Quick and dirty hack and proof of concept import time import urllib import urllib2 import android droid = android.Android() droid.startLocating('coarse') time.sleep(5) while True: l = droid.readLocation() res = l['result'] if res is None: time.sleep(5) continue lon, lat, alt, speed = res['longitude'], res['latitude'], \ res['altitude'], res['speed'] data = dict(imei='', lat=lat, long=lon, speed=speed) try: # pos-update code available at: http://km.krot.org/code/pos-update.lsp res = urllib2.urlopen('http://km.krot.org/pos-update.cgi?' + urllib.urlencode(data)) res = res.read().strip() print time.ctime(), res except (urllib2.URLError, ValueError, TypeError): pass time.sleep(900)