/Python-Kivy-Flask-Android-Example

A Python Kivy app that runs a Flask web app on desktop/Android

Primary LanguagePython

Kivy App with Flask Example

This is a template application that shows how Flask and Kivy can work together. This example runs on Android. It starts Flask in a background thread and logs incoming requests to a text output on the Android screen.

ALso see these relevant tutorials:

Setup

You need Kivy and Buildozer. You must be on Linux for Android build to work.

python3 -m pip install kivy buildozer

Build, install, and run

Use buildozer to create Android APKs, deploy, and run.

# Build
python3 -m buildozer android debug
# Build and install
python3 -m buildozer android debug deploy
# Build, install, and run
python3 -m buildozer android debug deploy run
# Build, install, and run with log output
python3 -m buildozer android debug deploy run logcat

Get the IP address of the device

python3 -m buildozer -v android adb -- shell ifconfig wlan0

Run curl from Android

Running curl from the Android device can be useful for testing Flask.

python3 -m buildozer -v android adb -- shell "curl localhost:5000"