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();
}
}
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();
}
}