i have a code
@TargetApi(23)
private void setTorchMode( CameraManager cameraManager, String id, boolean switchOn) throws CameraAccessException {
try {
final Method setTorchMode = cameraManager.getClass().getMethod("setTorchMode", String.class, boolean.class);
cameraManager.setTorchMode(cameraManager.getCameraIdList()[0],switchOn);
callbackContext.success();
} catch (IllegalArgumentException m){
} catch (Throwable t) {
callbackContext.error(t.getMessage());
}
when i try turn off camera led, i have crash
FATAL EXCEPTION: main
Process: uk.co.sparkenergy.androidapp2, PID: 31200 java.lang.IllegalArgumentException: Receiver not registered: android.hardware.camera2.CameraManager$1@6e1ab65
at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:793)
at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1200)
at android.hardware.camera2.CameraManager$3.run(CameraManager.java:1266)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5763)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
only 1 device Sony e5633, help please)