Testing on Mobile

**Overview**

Allows building and testing Flet applications directly on iOS and Android devices using Python. The process involves installing a Flet client app on the mobile device and running the Flet development server on the computer.

**Current Status**

An updated Flet app supporting API 0.80.0 is under development. The current App Store and Google Play versions support Flet 0.28.3.

**Requirements**

  • **Computer Prerequisites**: Must meet the requirements outlined in the Flet installation guide.
  • **Network**: The mobile device and the computer must be connected to the same Wi-Fi or local network.
  • **Environment**: Creating a virtual environment is recommended for managing dependencies.
  • **iOS Setup**

    1. **Install Flet App**: Install the Flet iOS app from the [App Store](https://apps.apple.com/app/flet/id1624979699). 2. **Run Development Server**: * Using uv: uv run flet run --ios [script] * Directly: flet run --ios [script] * Using poetry: poetry run flet run --ios [script] * [script] refers to your main Python application file.

    **Android Setup**

    1. **Install Flet App**: Install the Flet Android app from the [Google Play Store](https://play.google.com/store/apps/details?id=com.appveyor.flet). 2. **Run Development Server**: * Using uv: uv run flet run --android [script] * Directly: flet run --android [script] * Using poetry: poetry run flet run --android [script] * [script] refers to your main Python application file. 3. **Connect Device**: * A QR code with the project URL will be displayed in the terminal. * Open the device's Camera app, scan the QR code, and click the URL to open it in the Flet app. * Alternatively, manually add the project URL by clicking the '+' button in the Flet app.

    **Development Workflow**

  • **Hot Reload**: The flet run command starts the app in hot reload mode, automatically refreshing the app on the device when code changes are detected.
  • **Navigation to Home**:
  • * **iOS**: Not explicitly detailed, assumed to be handled by the Flet app's UI. * **Android**: Long-press anywhere on the screen with 3 fingers or shake the device.
  • **Manual Project Addition**: Click the '+' floating action button within the Flet app and enter the project URL.
  • **Examples**

  • **Hosted Counter App**: https://flet-counter-test-ios.fly.dev (for testing on iOS).
  • **In-App Gallery**: The Flet app includes a 'Gallery' tab with additional examples.
  • **GitHub Repository**: Explore more examples in the [Flet examples](https://github.com/flet-dev/flet/blob/main/sdk/python/examples) directory on GitHub.