File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ # AndroidFlashLight
2+ This Project is built on the latest SDK and is meant to build a flash light example in android
3+
4+ Download the app Here:
5+
6+
7+ #### Implementation
8+
9+ Step 1. Add the JitPack repository to your build file
10+ Add it in your root build.gradle at the end of repositories:
11+ ```
12+ allprojects {
13+ repositories {
14+ ...
15+ maven { url 'https://jitpack.io' }
16+ }
17+ }
18+ ```
19+ Step 2. Add the dependency
20+ ```
21+ dependencies {
22+ implementation 'com.github.Lucem-Anb:AndroidFlashLight:1.0.0'
23+ }
24+ ```
25+ That's it!
26+
27+ ### Usage
28+ ##### Permissions
29+ ```
30+ <uses-permission android:name="android.permission.CAMERA" />
31+ <uses-feature android:name="android.hardware.camera" />
32+ ```
33+ ##### Initialize
34+ ```
35+ mTorch = new Torch(this);
36+ ```
37+
38+ Check for permissions
39+ ```
40+ if (!mTorch.isPermissionGranted()){
41+ mTorch.requestPermission(this);
42+ return;
43+ }
44+ ```
45+
46+ Toggle the torch on or off
47+ ```
48+ mTorch.turnOn();
49+ mTorch.turnOff();
50+ ```
51+
You can’t perform that action at this time.
0 commit comments