manatlan / htag

Python3 GUI toolkit for building "beautiful" applications for mobile, web, and desktop from a single codebase
https://manatlan.github.io/htag/
MIT License
99 stars 4 forks source link

How could I run this as a part of an Android app? #7

Closed ItsCubeTime closed 1 year ago

ItsCubeTime commented 1 year ago

The readme mentions android, is it just to indicate that the html elements are prepped to display well on mobile devices, or has this library been tested with a backend running on Android, if so, are there any example projects?

manatlan commented 1 year ago

HI @ItsCubeTime ...

Here is a recipe/example to transform your "htag app" (you main component) into an android/apk. https://github.com/manatlan/htagapk

Here is the "htag app" : (here, the App'Class) https://github.com/manatlan/htagapk/blob/main/app/main.py

It's runned in an AndroidApp Runner. see https://github.com/manatlan/htagapk/blob/227d9c01ed0c0261947c34f749bd5a540d0a0345/app/main.py#L82

Here ... the APK is builded by a CI/CD github action : https://github.com/manatlan/htagapk/blob/main/.github/workflows/build.yml

But you could build it locally, using kivy/buildozer (see readme)

The AndroidApp runner, is a bit like the BrowserHTTP runner ..... but will use kivy to start an webview intent to display the GUI on the android device, and will run a http/server in a android thread, to interact with the UI in the webview. So it makes an (13Mo) APK which embbed everything to be runned in the android.