marzika/Snapprefs

[Request] Use Front LED flash instead of white screen

Opened this issue · 3 comments

Some devices have a LED as a front flash like Galaxy J7 and some chinese brands. Could you implement an option, so front LED can be used as flash instead of white screen (either turned on from snapchat or with volume buttons)?

There are some apps that uses the front led in this link: https://forum.xda-developers.com/galaxy-j7/themes/j7-flash-notification-torch-t3338126

The author released the source code here: https://app.box.com/s/bacyb9f9z5fvtq19vrw4ah08mh3ubo3h

Thanks!

M1kep commented

I "could" try this, but I don't have a device to test with unfortunately

I would be happy to test, if you can supply the apk. Otherwise I have no experience on compiling.

By the way, I've tried to do it myself some time ago, but couldn't even set up the environment to compile on unmodified snapprefs. These were the references to the flash that I've found in the source code:
...
import android.hardware.Camera;
import android.hardware.Camera.CameraInfo;
import android.hardware.Camera.Parameters;

...
camera = Camera.open(CameraInfo.CAMERA_FACING_FRONT);
Parameters p = camera.getParameters();
p.setFlashMode(Parameters.FLASH_MODE_TORCH);
camera.setParameters(p);
camera.startPreview();

It seems like setting FLASH_MODE_TORCH is sufficient, but I wasn't sure if snapchat will let snapprefs to modify camera parameters.