0

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!

ChrRing
  • 1
  • 1
  • how are you executing python script? and how are you connecting to android device? – Sasuke Uchiha Jan 08 '20 at 20:26
  • I have Pydroid 3 (https://play.google.com/store/apps/details?id=ru.iiec.pydroid3&hl=de) as a Python IDE installed on my phone and execute the code locally on the phone. – ChrRing Jan 09 '20 at 07:05

0 Answers0