Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

🔦 MvvmCross plugin to access the device's flash/torch

Notifications You must be signed in to change notification settings

heytherewill/Mvx.Flashlight

Repository files navigation

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

About

🔦 MvvmCross plugin to access the device's flash/torch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published