Skip to content

xamcat/XamTrack

Repository files navigation

XamTrack

build

This repo is the sample code presented as part of the Reactor Twitch Stream on the Microsoft Developer Twitch. This is sample app to demonstrate location tracking using a mobile client (Android and iOS) built using Xamarin, Azure IoT Hub and PowerBi Dashboard.

Coming soon

If you have come here from the Twitch Stream, come back to find the link for the direct link to the video here!

Bookmark, Subscribe the Reactor YouTube channel to get the notification for this video and other amazing content!​

Xamarin Client App

XamTrack is a sample single view Xamarin app demonstrating the use of Azure IoT Hub and Auto Provisioning via Azure IoT Hub Device Provisioning Service.

XamTrack App for Android

The sample mobile app (illustrated above) is built using Xamarin.Forms and leverages Xamarin Essentials feature Geolocation.

Solution Overview

The solution consists of the following projects:

XamTrack.Core:
Project contains the main service logic, and can be used to drive any UI, like a console app or here, a Xamarin Client app

XamTrack:
The XamTrack Forms project which contains the XAML and shared code

XamTrack.Android:
The XamTrack Android specific project contains Android assets

XamTrack.iOS:
The XamTrack iOS specific project contains iOS assets

XamTrack.UnitTests:
The Unit Test project

Key Concepts

MVVM

The app uses the MVVM (Model-View-ViewModel) pattern to decouple business logic & presentation code. In this sample, we are using TinyMVVM.

Unit Tests

Unit tests are run using NUnit. App service functionality is mocked using Moq which highlights a benefit of using a Service Container.

Continuous Integration

CI is being done via GitHub Actions. It has a basic build and run action setup for this repo. You can look at the workflow in the Action Tab and to see the code you can look here.

Running the Xamarin App

You must perform the following prerequisite actions in order to run this sample app:

  1. Create IoT Hub
  2. Create a new IoT Hub Device Provisioning Service
  3. Link the IoT hub and your Device Provisioning Service
  4. Xamarin.Forms Map Initialization and Configuration

The following app secrets are defined in the appconfig.json class and need to be replaced with the values generated in the steps above.

  1. DpsIdScope
  2. IotHubConnectionString
  3. DpsSymetricKey
  4. DpsSymetricKey

Be sure to configure the Native iOS and Android settings for Maps to work and the azure variables before deploying the app to avoid runtime errors.

Setting up Power Bi Dashboard

powerbi dashboard

Try Power Bi for free and create an account.

Follow the steps in this tutorial. Add a ArcGIS Map and follow this documentation here.

Additional Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published