User Tools

Site Tools


android:scripts

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
android:scripts [2011/03/02 23:37] 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 ===== ===== 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}} {{tag>cs_lang:python python gps location android google}}
android/scripts.txt · Last modified: 2011/03/03 08:09 by cedric