简体   繁体   中英

How do you import android modules on android?

I'm running Python3 on Android and I can import android, but I can't import any android submodules.

My goal is to have my scripts react to events, such as plugging/unplugging the headset, but I'm struggling to follow the examples found online.

One group seems to think that you should import jnius and use this autoclass() helper, while the other things you should directly import android.broadcast.

I'm struggling because python cannot find either jnius or android.broadcast installed, yet android.Android() works fine.

How do you properly import the android.broadcast.BroadcastListener object in python?

You can't import android.broadcast because the module doesn't exits. I've unzipped /data/data/com.hipipal.qpy3/files/lib/python3.2/python32.zip and there is no trace of broadcasts. If you can find the module, you can put it under /data/data/com.hipipal.qpy3/files/lib/python3.2/site-packages .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM