SETUP
Be sure to install the Shiny.Sensors nuget package in your shared code project
To use each type of sensor, use the following in your ShinyStartup:
using Shiny;
using Microsoft.Extensions.DependencyInjection;
namespace YourNamespace
{
public class YourStartup : ShinyStarup
{
services.UseAccelerometer();
services.UseAmbientLightSensor();
services.UseBarometer();
services.UseCompass();
services.UseMagnetometer();
services.UsePedometer();
services.UseProximitySensor();
services.UseHeartRateMonitor();
services.UseTemperature();
services.UseHumidity();
}
}
NOTE: each Use
returns a boolean as to whether or not it is supported. You can use optional dependencies (ie. IDependency dep = null) in your viewmodels/services then check for null to see if the sensor is available on the device.