user1224214
user1224214

Reputation: 21

Android Python get gps status

New to Android Python scriptring comming from Symbian PyS60. I want to port my gps info PyS60 app to Android sl4a Python. I can get the location but that is about all. From API docs and Java examples it would seem that something like: import android.location.LocationManager as lm satus = lm.getGpsStatus() would do the trick but I am getting nowhere. Please help me on track (cython perhaps???) Thanks, Janwillem

Upvotes: 2

Views: 8292

Answers (2)

Yash Bhadra
Yash Bhadra

Reputation: 11

 import android, time
 droid = android.Android()
 droid.startLocating()
 time.sleep(15)
 loc = droid.readLocation().result
 if loc = {}:
   loc = getLastKnownLocation().result
 if loc != {}:
   try:
     n = loc['gps']
   except KeyError:
     n = loc['network'] 
   la = n['latitude'] 
   lo = n['longitude']
   address = droid.geocode(la, lo).result
 droid.stopLocating()

Upvotes: 1

XcinnaY
XcinnaY

Reputation: 284

a short example of python code using the GPS:

import android, string, time
droid = android.Android()
droid.startLocating()
time.sleep(10)
l = droid.readLocation()

I found this in the tutorial page of sl4a http://code.google.com/p/android-scripting/wiki/Tutorials one of them is called: "Track where you go! Lua sample and python scripts to track your location."

the complete doc is in LocationFacade Here: http://www.mithril.com.au/android/doc/

Upvotes: 4

Related Questions