2012-02-21 102 views
2

Android新手来自Symbian PyS60的Python脚本。我想将我的GPS信息PyS60应用移植到Android sl4a Python。我可以得到的位置,但这是所有。从API文档和Java示例,它似乎是这样的: 导入android.location.LocationManager作为lm satus = lm.getGpsStatus() 会做的伎俩,但我无处可去。 请帮我的轨道上(用Cython也许???) 谢谢,JanwillemAndroid Python获取GPS状态

回答

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() 
+0

这是希望它可以帮助! :) – 2016-02-09 16:47:34