When I keep my device locked the flash light stopped, how do I keep my app going?

A

AC Question

when i keep my device locked flash light stoped ho to alive my aap ?

i've also use wake lock f but could not solved the problem, i have made this method and i'm calling it to my turn on light function

public void acquirewakeLock() {

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
"My wakelook");
wakeLock.acquire();
Toast acquire = Toast.makeText(getApplicationContext(), "Wake Lock ON",
Toast.LENGTH_SHORT);
acquire.show();

}
********************
this is TurnLightONFunction
*************************************
private void turnOnFlash() {
if (!isFlashOn) {
if (camer == null || prms == null) {

return;
}
// playSound();

prms = camer.getParameters();

prms.setFlashMode(Parameters.FLASH_MODE_TORCH);
camer.setParameters(prms);
camer.startPreview();
isFlashOn = true;
toggleButtonImage();
acquirewakeLock();

}
}
 

Members online

Forum statistics

Threads
943,173
Messages
6,917,631
Members
3,158,861
Latest member
dumpsterrentals38