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
问问题
7926 次
2 回答
4
使用 GPS 的 Python 代码的简短示例:
import android, string, time
droid = android.Android()
droid.startLocating()
time.sleep(10)
l = droid.readLocation()
我在 sl4a http://code.google.com/p/android-scripting/wiki/Tutorials的教程页面中找到了这一点, 其中之一被称为:“跟踪你去哪里!Lua 示例和 python 脚本来跟踪你的位置。 "
完整的文档位于 LocationFacade 这里: http: //www.mithril.com.au/android/doc/
于 2012-02-28T15:56:29.100 回答
1
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()
于 2016-02-09T16:46:27.807 回答