🔦 MvvmCross Flashlight Plugin
This plugin allows you to use the device's flash in any MvvmCross project.
Install via NuGet using:
PM> Install-Package Mvx.Flashlight
Resolve it:
var flashlightService = Mvx.Resolve<IFlashlightService>();
Use it at will:
//Checks whether the user is using a phone or a toaster
flashlightService.DeviceHasFlashlight;
//Indicates if the flashlight is currently on or not
flashlightService.IsFlashlightOn
// Those two are self explanatory
flashlightService.EnsureFlashlightOn();
flashlightService.EnsureFlashlightOff();
Check the Sample projects for a working example.
You need to add the camera permission to your Android manifest in order to make this puglin work:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />