Mobile backend, APK, and Play Store release

Flaxon is the mobile backend. It serves HTTPS JSON, GraphQL, WebSocket, uploads, authentication, and push-notification endpoints. It does not turn Python into an APK. The Android client is built separately with Kotlin, Flutter, React Native, or a web wrapper.

1. Create the Flaxon API

from flaxon import Flaxon
from flaxon.validation import Schema, fields

app = Flaxon("mobile-api")

class Device(Schema):
    device_id = fields.StrField(required=True, min_length=8)
    platform = fields.ChoiceField(["android", "ios"], required=True)

@app.post("/api/v1/devices")
async def register_device(data: Device):
    # Persist this record with your configured database.
    return {"device": data.to_dict()}

@app.get("/api/v1/health")
async def health():
    return {"ok": True}

# Run with: flaxon run app:app --host 0.0.0.0 --port 8000

2. Call it from Android

interface FlaxonApi {
    @GET("api/v1/health")
    suspend fun health(): HealthResponse

    @POST("api/v1/devices")
    suspend fun register(@Body device: DeviceRequest): DeviceResponse
}

val retrofit = Retrofit.Builder()
    .baseUrl("https://api.example.com/")
    .addConverterFactory(MoshiConverterFactory.create())
    .build()

Keep the API URL configurable, use Android Network Security defaults, send bearer tokens through an interceptor, and never ship database credentials or signing keys in the client.

3. Build an Android app bundle

For a native Android client, open the Android project in Android Studio, set an application ID and version, configure a release keystore, then build an Android App Bundle. Google Play normally expects .aab; an APK is useful for local/device testing.

./gradlew test
./gradlew bundleRelease
# optional device build
./gradlew assembleRelease

For a Teloce web client wrapped with Capacitor, see Teloce-Py to Android. Capacitor is a client wrapper; it does not replace the Flaxon server.

4. Submit to Google Play

  1. Create the app in Play Console and reserve the package name.
  2. Complete the store listing, app access instructions, privacy policy, data safety form, content rating, target API requirements, and screenshots.
  3. Upload the signed app-release.aab to an internal test track first.
  4. Invite testers, verify login, API failures, deep links, offline behavior, permissions, and production HTTPS.
  5. Promote the tested release to closed/open testing, then production; provide release notes and staged rollout settings.
Release boundary: deploy Flaxon independently with migrations, backups, logs, rate limits, and health checks. Upload only the Android client bundle to Play Console.

Chaquopy: embed Python in an Android app

Chaquopy adds Python to a normal Android Studio project. Kotlin or Java remains the Android UI and lifecycle layer. Use this pattern when you need Python libraries on-device; do not place a production Flaxon server inside the APK unless you have a very specific offline/server-in-device design.

Start with the Chaquopy Android documentation and add the current Chaquopy Gradle plugin version required by your project:

plugins {
    id "com.android.application"
    id "com.chaquo.python" version "REPLACE_WITH_CURRENT_VERSION"
}

In the app module, declare Python requirements and source directories according to the Chaquopy setup guide:

chaquopy {
    defaultConfig {
        version = "3.11"
        pip {
            install "requests"
        }
    }
    sourceSets {
        getByName("main") {
            srcDir("src/main/python")
        }
    }
}

Place a small Python client in app/src/main/python/mobile_api.py:

import requests

def health(base_url):
    response = requests.get(base_url + "/api/v1/health", timeout=10)
    response.raise_for_status()
    return response.json()

Call that function through Chaquopy's Python API from Kotlin, or keep the network client in Kotlin with Retrofit. The Flaxon API remains remote at https://api.example.com; use HTTPS, authentication, timeouts, certificate policy, and server-side authorization.

Important: Chaquopy embeds Python code in the client. It does not automatically make Flask or Flaxon a secure mobile server, and Python packages with native dependencies may need Chaquopy-compatible builds.

Termux: run Flask or Flaxon locally for development

Termux can run Python on an Android device. This is useful for learning, local demos, device-side tools, and testing a LAN service. It is not a replacement for a monitored HTTPS production deployment or a normal Play Store client.

pkg update
pkg install python
python -m venv .venv
source .venv/bin/activate
python -m pip install flaxon
flaxon run app:app --host 0.0.0.0 --port 8000

For Flask, install Flask and run the app with its development command only for local testing. Do not expose a development server to the public internet. On the phone, open http://127.0.0.1:8000; another device needs the phone's LAN address and firewall/network permission. Store data carefully and stop the process when it is not needed.