5

I was following this tutorial on how to create an Android service using kivy, and about half way down the page under the heading 'Starting the Service', the code example has the line from android import AndroidService. I see that I don't have the android module installed and I can't figure out how to go about getting it, even after googling around for it, and searching with pip and apt-get. It seems as if there might even be different android modules out there. Can someone point me in the right direction?

I currently have kivy set up properly(on ubuntu) and can make, run and deploy without any issues.

1 Answer 1

6

The android module is automatically included in apks built with kivy's python-for-android, so you don't have to do anything special to use it. It's not available on the desktop though.

Sign up to request clarification or add additional context in comments.

5 Comments

Ah, I see. I had a feeling it might just get bundled in there somehow. It's a pity as I was hoping to explore it with ipython or somesuch.
The problem is that it's actually cython that directly interacts with the java environment. You might be interested in kivy-remote-shell though, which lets you explore these things via a python shell on the phone over ssh.
so you are saying each time i need t orun the code i need to go through all the apk compilation process to do a import android;print('hello world') *(semicolon can be used in python to perform multiple command in single line)
@RatulHasan If you want to import the android module, and have it work, your code must be running on android.
Instead of updating the android app again and again, you can create "loader" apk once with all required dependencies and have it import your main py files from internal storage. This way you can easily test new features without having to build the app again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.