I am trying to read data from an Android device with Python using Pydroid3.
I first tried the following:
import android, time
droid = android.Android()
droid.startLocating(0, 0)
event = droid.eventWait(1000).result
if event['name'] == "location":
print(event['data']['gps'])
droid.stopLocating()
But this fails with:
Error importing module "android": this module is a part of Kivy
You cannot use it from elsewhere
Would be cool, if I could use it...
I then tried to use plyer to test an alternative:
from plyer import gps
def print_locations(**kwargs):
print('lat: {lat}, lon: {lon}'.format(**kwargs))
gps.configure(on_location=print_locations)
gps.start()
# later
gps.stop()
And that fails with:
ModuleNotFoundError: No module named 'plyer.platforms.linux.gps'
I couldn't really find any resources that had similar issues... Help is highly appreciated as I am a bit stuck here...
Thanks!