How to Run the ThingsBoard Mobile App on Android (Self-Hosted Server)

If you’re hosting your own ThingsBoard instance (e.g. https://thingsboard.maksonlee.com) and want to run the official mobile app on Android, this guide walks you through everything, from configuring the server to running the app using Flutter on Windows.


Part 1: Create a Mobile App Bundle in ThingsBoard

Before running the mobile app, you must define a Mobile App Bundle in your ThingsBoard server. This bundle tells the app how to log in, which dashboards to load, and how the interface should look.


  1. Open Mobile Center
  • Log in as System Administrator
  • Navigate to Mobile center → Bundles
  • Click Add bundle

  1. Basic Bundle Settings
FieldValue / Description
TitleMakson Mobile App
Description (optional)Mobile client for ThingsBoard at maksonlee.com

  1. Android Application Configuration

Click Create new under the Android Application section and enter:

FieldValue / Description
Application Packageorg.thingsboard.app (or com.makson.tbmobile)
Platform TypeAndroid
Application SecretAuto-generated, save this value
StatusChange from Draft to Published

Click Add, then Next.


  1. Configure OAuth 2.0
FieldValue / Description
Enable OAuth 2.0Enabled
OAuth 2.0 ClientsKeycloak Login (select existing)

Need help setting up Keycloak with ThingsBoard?

See: How to Enable OAuth2 Login in ThingsBoard 4.0.1 CE Using Keycloak and HAProxy

Click Add, then Next.


  1. Layout

Use the default layout settings provided by ThingsBoard. No changes are needed unless you want to customize dashboard tabs, menus, or mobile actions.

Click Save to complete the mobile app bundle.


Part 2: Build and Run the App

Once the mobile app bundle is ready, you can build and run the ThingsBoard Flutter app on Android using Windows.


  1. Clone the Mobile App Source Code
git clone https://github.com/thingsboard/flutter_thingsboard_app
cd flutter_thingsboard_pe_app

  1. Install Flutter Version

Use FVM on Windows to ensure the correct version is installed:

fvm install

  1. Configure Server Endpoint and Secret

Open:

lib/constants/app_constants.dart

Update the following constants:

const thingsBoardApiEndpoint = 'https://iot.maksonlee.com';
const thingsboardAndroidAppSecret = 'YOUR_APPLICATION_SECRET_HERE';

Replace YOUR_APPLICATION_SECRET_HERE with the actual value copied from your Android app definition in ThingsBoard.

Since we’re using OAuth, and we configured a custom domain iot.maksonlee.com, so we use it here instead of thingsboard.maksonlee.com

Save the file.


  1. Run the App on Android

You can use either an emulator or a real Android device:

  • Start an emulator from Android Studio

or

  • Connect a phone with USB debugging enabled

Then run:

fvm flutter clean
fvm flutter run

The app should launch and show the login screen. Log in using your Keycloak OAuth provider or a regular ThingsBoard tenant/customer account.


Java 21 Compatibility Issue

If you encounter the error:

unsupported class file major version 65

This is caused by Flutter or Gradle using Java 21, which is not fully compatible with some Android builds.

Follow this guide to fix it:
Fix Unsupported Class File Major Version 65 in Flutter Android Builds (Java 21 Issue)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top