立即试用 商务报价
Mobile PE应用程序
文档 > 入门

本页目录

Getting started with ThingsBoard PE Mobile Application

Introduction

The goal of this tutorial is to demonstrate the basic setup of ThingsBoard PE Mobile Application with your ThingsBoard PE platform instance. You will learn how to:

  • Setup development environment;
  • Get application project source code;
  • Configure API endpoint to your ThingsBoard PE platform instance;
  • Build and run your version of ThingsBoard PE Mobile Application;

Step 1. Prepare development environment

Flutter ThingsBoard PE Mobile Application requires Flutter SDK starting from version 2.12.0. Follow these instructions in order to setup Flutter SDK. For an even better experience we recommend to set up an editor using these instructions.

Flutter ThingsBoard PE Mobile Application is served by ThingsBoard PE platform starting from version 3.3.0. You will need to have ThingsBoard PE server up and running. The easiest way is to use ThingsBoard Cloud. The alternative option is to install ThingsBoard PE using Installation Guide.

Step 2. Get app source code

You can get Flutter ThingsBoard PE Mobile Application source code by cloning it from github repository:

1
git clone https://github.com/thingsboard/flutter_thingsboard_pe_app.git

Step 3. Configure ThingsBoard PE API endpoint

Open flutter_thingsboard_pe_app project in your editor/IDE. Edit lib/constants/app_constants.dart.

Set value of thingsBoardApiEndpoint constant to match api endpoint of your ThingsBoard PE server instance.
In case of ThingsBoard Cloud set it to https://thingsboard.cloud.

1
2
3
4
5
6
abstract class ThingsboardAppConstants {
  static final thingsBoardApiEndpoint = 'https://thingsboard.cloud';
  
  ...
}

Note: Do not use localhost or 127.0.0.1 host names.
If you are using local ThingsBoard PE installation use alternative ip address/host name accessible within your local network.
You can read Connecting Flutter application to Localhost for more information.

Step 4. Run the app

Run the app in the way your IDE describes.

When using terminal run the app with the following command:

1
flutter run

You should see either Android or iOS output, depending on your device.


Android login screen Android
iOS login screen iOS

Tip: The first time you run on a physical device, it can take a while to load. Afterward, you can use hot reload for quick updates.

Save also performs a hot reload if the app is running. When running an app directly from the console using flutter run, enter r to perform hot reload.

Next Steps

  • Customize your app - Learn how to customize your ThingsBoard PE Mobile Application to meet your requirements.
  • Publish your app - Learn how to build release and publish your version of ThingsBoard PE Mobile Application to Google Play or App Store.