This demo application is built using Flutter and Yonomi's latest IoT API.
This demo app is to help you get acquainted with Yonomi's developer tools. This app also follows best practices for building a Flutter application using Yonomi platform. You can fork this application as a starting point for your own IoT mobile and web applications and use it as a head start on development.
This demo is a great place to start understanding the kind of applications you can build using Yonomi. You may use the instructions below to get an instance of this demo running on your local machine, or you can work with members of Yonomi's sales team to see this demo in action.
You will need to have a machine set up with the Flutter SDK.
https://flutter.dev/docs/get-started/install
You will need a tenant ID and a private key to get started. Once you have a private key, the private key file should be placed in the assets
folder, with filename jwtRS256.key
It is NOT recommended that this file is added in source control and only be generated during CI/CD process.
If you need guidance on obtaining any of these, please contact our sales team to help you get started using our platform.
Add your tenant ID and private key to the app:
-
Create a file
.env
in your app'sassets
folder. -
Add the following entries in your
.env
file. Make sure to replaceYOUR-TENANT-ID
with your Tenant ID andYOUR-PRIVATE-KEY
with your private key.
TENANT_ID: YOUR-TENANT-ID
PRIVATE_KEY: YOUR-PRIVATE-KEY
- Double-check your
pubspec.yaml
file to make sure that the file is defined under theassets
section:
flutter:
...
assets:
- assets/.env
- Open
assets/config.yaml
and updateurl
with the platform's graphQL endpoint:
URL: https://platform.yonomi.cloud/graphql
- Double-check your
pubspec.yaml
file to make sure that this file is defined under theassets
section:
flutter:
...
assets:
- assets/config.yaml
We have used Firebase to collect crash logs and to easily distribute app builds. To correctly run the app you will need firebase related config files. Each for ios and android. Use the following guides below to set it up on your desired platform(s):
Make sure you follow the steps under Add a Firebase Configuration File
to know where to place your google-services.json
file
Make sure you follow the steps under Add a Firebase Configuration File
to know where to place your GoogleService-Info.plist
file.
Update gitignore to be able to track these files if needed by the organization.
You will use YoRequest.request()
to simplify making requests to the platform.
Example: Building a request object using user ID "1234"
Request request = await YoRequest.request("1234");
Note: This method builds a valid request by using the configured graphql endpoint, the user ID passed in as a parameter, the private key file named jwtRS256.key
, and the configured tenant ID.
You can use either iOS or Android devices to run the demo app.
- Simulator
- Real device
Visit the following link to download XCode:
https://developer.apple.com/support/xcode/
- Emulator
- Real device
Visit the following link to download Android Studio:
https://developer.android.com/studio
When you open the app, you will be prompted for a User ID. You can input anything as your User ID or you can use one previously used to navigate to the next screen.
At the bottom you can select three tabs to navigate to the Home, Devices, or Settings screens.
Press the '+' floating action button and select an integration from the list.
You will be taken to that integration's authentication page.
Input your credentials for that account, and if you authenticated successfully, you will be taken back to the app and see all devices under that account.
- Install lcov:
brew install lcov
flutter test --coverage
genhtml coverage/lcov.info -o coverage/html
open coverage/html/index.html
This application is released under the Apache license v2.0