MagicalCamera
A library to take picture easy, transform your data in different format and save photos in your device
Install / Use
/learn @fabian7593/MagicalCameraREADME
A Magic library to take photos and select pictures in Android. In a simple way and if you need it also save the pictures in device, and facial recognition, get the real uri path or the photo or obtain the private information of the picture.
<br>
<a href='https://play.google.com/store/apps/details?id=com.frosquivel.magicalcameraapp'><img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png' height='80'/></a> <br>
Contents
Features
Buy me a Coffee (Donate)
How to Start
Photo Features and permissions
Footer Docs
<br><br>
Features MagicalCamera.
-
Take picture with camera device.
-
Select pictures in gallery device (read in devices).
-
Write the pictures that you taken in device, in your own directory.
-
Return the path of your photo in device. (This issue is solved for @arthursz)
-
RealTime Permissions Magical camera offers a simple integration of realtime permissions. (This functionallity is created by @cutiko)
-
Working in android 6.0 (We have a class to request the user permission).
-
Create yours standards of name of pictures, or use our standard, like "photoname_YYYYmmddHHmmss"
-
Posibility of shown the private info photography, like latitude, longitude, ISO or others with Exif Class.
-
Posibility of rotate picture when it's required.
-
Select the quality of the photo with a percentage, when 1 is the worst and 100 is the better.
-
Obtain the LandMark and return a bitmap with a facial recognition that you need.
-
Return the BitmapPhoto if you need to save this in internal DB of your application.
-
Convert your bitmap in array bytes or string64, if you need to send by Json or XML.
-
Type of photo formats: PNG, JPEG and WEBP.
Other Features
- A library completely OpenSource.
- Use best practice in POO
- Minimun SDK 14+ API.
- Support library
- Compile with Gradle
- License Under Apache 2.0
- The easiest possible integration
- Integrate in less than 5 minutes
- Quick and simple API
- A good Internal Documentation
Donate
<br> <br><br>Getting Started
Download Sources
use git (sourcetree or others) Remember Download the example for understand better the process
git clone https://github.com/fabian7593/MagicalCamera.git
Download from Here
Another type download by Bintray from
Setup
Add dependecies
If you need to take photo or select picture, this is your solution. This library give a magical solution for take a picture,write and red in device, return your uri real path and obtain yhe private info of the photo and facial recognition, you only need to download this and integrate this in your project, maybe downloading it or import in your gradle, like this.
repositories {
jcenter()
}
dependencies {
compile 'com.frosquivel:magicalcamera:6.0.0'
}
If you have any problem with this dependence, because the library override any styles, colors or others, please change the last line for this code:
compile('com.frosquivel:magicalcamera:6.0.0@aar') {
transitive = false;
}
<br>
How To use
<br>Import library
You need to import the library
import com.frosquivel.magicalcamera.MagicalCamera;
import com.frosquivel.magicalcamera.Functionallities.PermissionGranted;
//and maybe you need in some ocations
import com.frosquivel.magicalcamera.Objects.MagicalCameraObject;
<br>
Extends Application Class
You need to extends MagicalCamera application
public class MyApplicationClass extends MagicalCameraApplication {
@Override
public void onCreate() {
super.onCreate();
}
//IF YOU NEED MULTIDEX, SET HERE, NOT ON APPLICATION TAG ON MANIFEAST, LIKE THIS
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
On manifest, change the name, for the name of your Application class, like this:
<application
android:name=".MyApplicationClass">
Permissions on real time
With the MagicalPermissions class you can ask for permissions in a Activity or in an Fragment. This class will take care of validating the device API level, what permissions the user haven't granted yet, ask for thoose permissions, deliver the result and together with MagicalCamera will take the photo or select it from the gallery.
Requesting permissions on real time to the user is a 2 part process. First permissions most be requested, then the result is delivered. So you need a field variable to later call it again on the permissions result:
private MagicalPermissions magicalPermissions;
MagicalPermissions constructor accept two params, the first is the Activity or Fragment and the second is a String array of the permissions you need String[]. MagicalPermissions use the Activity or Fragment to later deliver the result of the permission, and the array to ask for thoose permissions.
magicalPermissions = new MagicalPermissions(this, permissions);
Inside MagicalPermissions it will be solved if the API level of the device requiere to ask permissions or not. If permissions must be asked to the user then MagicalPermissions will validate which permissions are already granted and only asked for the needed. This is why is very important you only ask for the permissions you need, taking the photo or selecting it will only happen if every permission you have asked is granted.
- By example, if you only need to take the photo then:
String[] permissions = new String[] {
Manifest.permission.CAMERA
};
magicalPermissions = new MagicalPermissions(this, permissions);
- MagicalCamera take care of saving the photo commonly you will need:
String[] permissions = new String[] {
Manifest.permission.CAMERA,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
magicalPermissions = new MagicalPermissions(this, permissions);
- Or maybe you want to use more potential of MagicalCamera and also ask for location related info, then you need:
String[] permissions = new String[] {
Manifest.permission.CAMERA,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION
};
magicalPermissions = new MagicalPermissions(this, permissions);
You can also ask for other permissions in other places of your app, even unrelated to MagicalCamera using MagicalPermissions separatedly. So if getting location information is not requiered for the photo, but is a plus, you should consider separating thoose permissions from the absolutely needed to your feature. MagicalPermissions use a Runnable to do whatever you want after checking the permissions. When is used along with MagicalCamera you don't have to be aware of that, is automatic, but in this case we are considering asking for other permissions:
String[] location = new String[]


