1

How should I go about making my kivy application work on a Samsung Galaxy S7? How much of the code do I have to change to make it work? Do I get features of the phone like handling "back" or vibration? Currently my code has two files, a calc.py file which handles all the back-end calculations that are given from main.py which is a KivyApp class which returns my main class.

There are also images that are used in the same folder from main.py

If there is a better place to post this please tell me

Thank you!

Max Bethke
  • 286
  • 1
  • 2
  • 18
  • 1
    Note that packaging for android is done with buildozer, which is only available in linux so far (or a linux VM on Windows). Take a look here https://kivy.org/docs/guide/packaging-android.html for how-to – George Bou Oct 11 '17 at 21:06

1 Answers1

2

You are on the right place to ask this.

First you have to convert your app in a apk using python-for-android, the easiest way is to use buildozer.
You'll probably need to make your code compatible with python2, apparently there is a new buildozer that allow pure python3, but the classic one work on python2.

For the images, if you want to keep them here, it will work, but I recommend that you put them on a "img" repo.

For the vibrations, and other android behaviors, there are 3 way to do this:
pyjnius that let you use every component you want by creating a binding to the android class.
plyer that have already create you a easy binding but don't have all the fonctionnalities.
python-for-android api, that is also really easy.

I recommand you check if you can do what want first with python-for-android or plyer, and if you can't, give a try to pyjnius.

MatEhickey
  • 127
  • 1
  • 10
  • The same buildozer works for both python2 and python3. You just change the command to build the apk. – George Bou Oct 12 '17 at 14:32
  • What is the new command ? Because by looking at the doc to support python3 you have to install buildozer from source, and not from pip (https://pypi.python.org/pypi/buildozer) – MatEhickey Oct 12 '17 at 14:57
  • They must have recently changed it. Until recently you could just use the `buildozer android_new` command to build the apk. – George Bou Oct 12 '17 at 15:33
  • I think that don't have to do with the python version, that the pipeline. Now, the old "android" command is replaced by "android_old", and "android_new" by just "android". I read that you can run python3 in experimental way with this procedure (https://stackoverflow.com/a/36545018/8204860), but didn't tested it yet – MatEhickey Oct 13 '17 at 07:58
  • Apparently the changes were made around 5 months ago. I have built android apk's in python 3 with the `android_new` command earlier this year but didnt use it since then. The changes can be found here: https://github.com/kivy/buildozer/commit/127c581f5bba075551173249fbab0a254a552d1b – George Bou Oct 13 '17 at 17:26