Created
January 30, 2020 07:59
-
-
Save riverfor/7ca4c7e22895ce01673987d4272d5c19 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from androidhelper import Android | |
droid = Android() | |
droid.startLocating() | |
locproviders = droid.locationProviders().result | |
print("locproviders:"+repr(locproviders)) | |
gpsprovider = droid.locationProviderEnabled('gps').result | |
print("gpsprovider:"+repr(gpsprovider)) | |
i = 0 | |
while i<100: | |
event = droid.eventWaitFor('location', 10000).result | |
print("Event:"+repr(event)) | |
location = droid.readLocation().result | |
if len(location) > 0: | |
print('Location:'+repr(location)) | |
else: | |
location = droid.getLastKnownLocation().result | |
print("Last location:"+repr(lastloc)) | |
loc = location['network'] # change to gps if you can get it | |
addr = droid.geocode(loc['latitude'], loc['longitude']).result | |
print("addr:"+repr(addr)) | |
time.sleep(1) | |
i = i+1 | |
droid.stopLocating() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment