I am writing a very simple script using QPython on my android phone. I would like to extract the GPS coordinates of my current location. However, the script only outputs the "network" coordinates, never the GPS. Here is the code snippet:
#qpy:2
#qpy:console
import androidhelper as android
import time, urllib2
while 1:
time.sleep(5)
droid=android.Android()
droid.startLocating()
event=droid.eventWaitFor('location', 10000).result
try:
lng=event['data']['gps']['longitude']
lat = event['data']['gps']['latitude']
print "Longitude: %s ||| Latitude: %s" %(lng,lat)
except:
print "Network Coordinates"
I experimented with the minimum update time e.g: droid.startLocating(10000, 0)
increased the waiting time for the eventWaitFor()
, moved around but the only coordinates I ever get are 'network'. Is there a way to "force" the return of GPS coordinates?