I made this simple code for activating and deactivating the flash of the phone and it’s working fine, but when i go in the multi tasking and then i re-enter in the app (without closing it) I can’t manage to re-activate the flash. I’m using Ketai library and I have allowed the permission to camera. This is the code:
import ketai.camera.*;
PImage flashOn;
PImage flashOff;
KetaiCamera cam;
void setup()
{
imageMode(CENTER);
cam = new KetaiCamera(this, 320, 240, 24);
cam.start();
flashOn = loadImage("flashOn.png");
flashOff = loadImage("flashOff.png");
}
void draw()
{
background(176);
if (cam.isFlashEnabled())
image(flashOn, width/2, height/2, width, width);
else
image(flashOff, width/2, height/2, width, width);
}
void mousePressed()
{
if (cam.isFlashEnabled())
cam.disableFlash();
else
cam.enableFlash();
}
Is there a way to make the program function even after going in the multi tasking and re-entering the app?
Thanks for your help.