-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
5,567 additions
and
22 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
linkTitle: "Create a mobile app" | ||
title: "Create a mobile app" | ||
weight: 20 | ||
layout: "docs" | ||
type: "docs" | ||
no_list: true | ||
description: "Create a custom user interface for interacting with machines from a mobile device." | ||
--- | ||
|
||
You can use Viam's [Flutter SDK](https://flutter.viam.dev/) to create a custom mobile application to interact with your devices. | ||
The Flutter SDK includes: | ||
|
||
- Implementation of the standard component and service APIs to control your hardware and software | ||
- Widgets to ease the development process | ||
- Authentication tools so users can log in securely | ||
|
||
## Example usage | ||
|
||
The following code, part of [Drive a rover in a square in 2 minutes](/how-tos/drive-rover/), shows how you could move a robotic rover base in a square using the base API's [`moveStraight`](https://flutter.viam.dev/viam_sdk/Base/moveStraight.html) and [`spin`](https://flutter.viam.dev/viam_sdk/Base/spin.html) methods: | ||
|
||
```dart {class="line-numbers linkable-line-numbers"} | ||
import 'package:flutter/material.dart'; | ||
import 'package:viam_sdk/viam_sdk.dart'; | ||
import 'package:viam_sdk/widgets.dart'; | ||
class BaseScreen extends StatelessWidget { | ||
final Base base; | ||
const BaseScreen(this.base, {super.key}); | ||
Future<void> moveSquare() async { | ||
for (var i=0; i<4; i++) { | ||
await base.moveStraight(500, 500); | ||
await base.spin(90, 100); | ||
} | ||
} | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar(title: Text(base.name)), | ||
body: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
ElevatedButton( | ||
onPressed: moveSquare, | ||
child: const Text('Move Base in Square'), | ||
), | ||
])) | ||
,);}} | ||
``` | ||
|
||
{{<video webm_src="/tutorials/try-viam-sdk/square-test-rover.webm" mp4_src="/tutorials/try-viam-sdk/square-test-rover.mp4" alt="An example flutter app moving a Try Viam rover in a square" poster="/tutorials/try-viam-sdk/square-test-rover.jpg">}} | ||
|
||
See the guide for full code and instructions to get started by building a simple app to control a rented Viam rover: | ||
|
||
{{< cards >}} | ||
{{% card link="/operate/control/mobile-app/drive-rover/" %}} | ||
{{< /cards >}} | ||
|
||
For a more in-depth guide with more screens, see the following guide: | ||
|
||
{{< cards >}} | ||
{{% card link="/tutorials/control/flutter-app/" %}} | ||
{{< /cards >}} | ||
|
||
## Set up authentication | ||
|
||
Viam uses [FusionAuth](FusionAuth) for authentication and authorization. | ||
|
||
Use the [Viam CLI `auth-app` command](/dev/tools/cli/#auth-app) to register your application with FusionAuth so that you or your users can log into your app with the same credentials they use to log into the [Viam app](https://app.viam.com). |
Oops, something went wrong.