I'm building a custom camera application for Android. The Camera.Parameters API contains methods like setPreviewSize or setPictureSize, that are working well.
But I am trying to use setJpegQuality(int) parameter:
Camera cam = getCameraInstance();
if(cam == null){
setResult(INSTANCE_ERROR);
finish();
}
params = cam.getParameters();
params.setJpegQuality(jpegQuality);
cam.setParameters(params);
I am testing my application on 3 different devices : an HTC Desire Z, a Galaxy S2 and a Galaxy S4.
setJpegQuality is working on HTC (Android 2.2.1) and on Galaxy S2 (4.1.2), but fails on Galaxy S4 device (4.2.2).
So my question : Is this function deprecated ? Is there another way to set picture quality ? On the Developer documentation it doesnt seems to be a deprecated function so i am a little confused...
I also tried
params.set("jpeg-quality", jpegQuality);
But its the same :(
Thanks for the answers.
For S3 and S4, you can write device specific code to reduce the size of file.
If you search on google, Android dev team also mentioned that it all depends on the implementation by the manufacturer(https://code.google.com/p/android/issues/detail?id=8091). The implementation of the camera parameters and function totally depends on the hardware used I think.
I had used motion sensors for one of my apps. There also, I had to write device specific code, to get the required behaviour in the app.
I know its not what we expect as a developer, but i believe we, developers, can fix anything. :)