User Tools

Site Tools


android:scripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
android:scripts [2011/03/02 23:32] – created cedricandroid:scripts [2011/03/03 08:09] (current) cedric
Line 1: Line 1:
 +These scripts require the installation of [[http://code.google.com/p/android-scripting/ | SL4A]].
 +
 ====== Python ====== ====== Python ======
 +===== Location =====
 +<code python>
 +import android, time
 +droid = android.Android()
 +
 +droid.startLocating()
 +time.sleep(10)
 +
 +while True:
 +    l = droid.readLocation().result
 +
 +    # provider = network or GPS
 +    latitude = l['network']['latitude']
 +    longitude = l['network']['longitude']
 +
 +    print latitude, longitude
 +
 +    time.sleep(10)
 +</code>
 +
  
 +{{tag>cs_lang:python python gps location android google}}
android/scripts.1299105163.txt.gz · Last modified: 2011/03/02 23:32 by cedric