Skip to content

An Android library to access Camera Flash in all the versions of Android.

License

Notifications You must be signed in to change notification settings

rcaboni/NoobCameraFlash

 
 

Repository files navigation

AUR Build Status Codacy Badge

NoobCameraFlash

An Android library to access Camera Flash in all the versions of Android. It takes care of the permissions and can also work in different flavor of Android OS.

Features

  • No need to code for extra permissions
  • Works on all versions of Android (Minimum API level 15)

Planned feature

  • More Customization support
  • Support for devices lower than Android 4.0

Setup

NoobCameraFlash is hosted at jitpack.io. The instructions are as follows -
Step 1. Add the JitPack repository to your build file. Add it in your root build.gradle at the end of repositories:

allprojects {
	    repositories {
			...
	    	maven { url "https://jitpack.io" }
		}
}

Step 2. Add the dependency

dependencies {
        compile 'com.github.Abhi347:NoobCameraFlash:0.1.2'
  }

Usage

Initialize the NoobCameraManager singleton.

NoobCameraManager.getInstance().init(this);

You can optionally set the Log Level for debug logging. Logging uses LumberJack library. The default LogLevel is LogLevel.None

NoobCameraManager.getInstance().init(this, LogLevel.Verbose);

After that you just need to call the singleton to turn on or off the camera flash.

NoobCameraManager.getInstance().turnOnFlash();
NoobCameraManager.getInstance().turnOffFlash();

You can take care of the runtime permission to access Camera yourself or can allow the library to do it for you

NoobCameraManager.getInstance().takePermissions();

Note: The library will take permissions, if you haven't already, even without calling takePermissions() explicitly. This behavior may change in future.

It's easy to toggle Flash too

NoobCameraManager.getInstance().toggleFlash();

It's a good practice to release all the resources, once you're done. NoobCameraManager.getInstance().release();

Note: The library doesn't guaranty good resource management yet. So use it with caution.

Contributions

Feel free to report bugs, feedback or even suggest new features. I'd love to make it a great library.

Donate

Paypal

Warning

NoobCameraFlash is not a production ready library (We haven't reached 1.0.0 yet) and thus you should not use it in a production ready code. Please read the license term carefully before including it in your projects.

About

An Android library to access Camera Flash in all the versions of Android.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%