🔦 MvvmCross plugin to access the device's flash/torch
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Client.Core
Client.Droid
Client.iOS
Flashlight.Droid
Flashlight.iOS
Flashlight
nuspec
tools
.gitignore
FlashLight.sln
README.md
Sample.sln
build.cake
build.sh

README.md

Mvx.Flashlight Build Status

🔦 MvvmCross Flashlight Plugin

This plugin allows you to use the device's flash in any MvvmCross project.

Installation

Install via NuGet using:

PM> Install-Package Mvx.Flashlight

Usage

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.

⚠️ Attention

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" />