How I Got the Gardening App up and Running on My Phone
I’ve spent the last few days working to get my app running on a phone. Since I have a Linux computer, I’m using an Android Virtual Device from Android Studio to simulate my phone. This is a lot easier than constantly transferring the data to my phone every time I need to make an update. However, I did the data transfer process a couple times to my phone and the app shows up there as well.
My first challenge was using Buildozer to create an APK (Android application package) that I could use to transfer my app to my phone. Here are the sites I used:
- Kivy Startup Guide: https://kivy.org/doc/stable/guide/packaging-android.html
- Buildozer Quickstart Guide: https://buildozer.readthedocs.io/en/latest/quickstart.html#init-and-build-for-android
The next challenge was that the app turned out to be on the bottom left corner. The reason for this was that I specified the pixel size and, of course, the phone is much bigger than the 400 x 600 pixels that I used on the laptop (see image). I fixed this by importing Config at the top of the page so that it applies to all the following modules. See code below image.
from kivy.config import Config
Config.set("graphics", "resizable", True)from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.core.window import Window
The next challenge was that the label font size did not change even though the app now fit the phone screen (image below). I fixed this issue by adding “sp” to the font_size property and putting it in quotes. For example- font_size: “20sp”. Before I was using font_size: 20. The added “sp” takes into account the operating system. The before and after are below:
The next challenge is to fix an issue with the phone erasing all data every time I do an update. I have to start from scratch in adding gardens and plants after each update. In addition, I would like to make it so that users can add photos to the app from their phones.