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.
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!
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.
The sample mobile app (illustrated above) is built using Xamarin.Forms and leverages Xamarin Essentials feature Geolocation.
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
The app uses the MVVM (Model-View-ViewModel) pattern to decouple business logic & presentation code. In this sample, we are using TinyMVVM.
Unit tests are run using NUnit. App service functionality is mocked using Moq which highlights a benefit of using a Service Container.
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.
You must perform the following prerequisite actions in order to run this sample app:
- Create IoT Hub
- Create a new IoT Hub Device Provisioning Service
- Link the IoT hub and your Device Provisioning Service
- 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.
- DpsIdScope
- IotHubConnectionString
- DpsSymetricKey
- 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.
Try Power Bi for free and create an account.
Follow the steps in this tutorial. Add a ArcGIS Map and follow this documentation here.