app will work if it app ask for camera permission, if no then go to your application details page and manually enable the camera permission and try again. If this method doesn’t work then try to restart your phone.
I catched the issue.
The needed permission was only asked automatic on the take picture block.
I will add the permission ask code to the toggle light block now too for next release.
if (!havePermission) {
form.askPermission(Manifest.permission.CAMERA,
new PermissionResultHandler() {
@Override
public void HandlePermissionResponse(String permission, boolean granted) {
if (granted) {
Camera.this.havePermission = true;
ToggleLight();
} else {
form.dispatchPermissionDeniedEvent(Camera.this, "ToggleLight",
Manifest.permission.CAMERA);
}
}
});
return;
}
//add here now the code which needs the above permission
You should use the code above in “void” like:
public void runMyMethod() {
if (!havePermission) {
form.askPermission(Manifest.permission.CAMERA,
new PermissionResultHandler() {
@Override
public void HandlePermissionResponse(String permission, boolean granted) {
if (granted) {
Camera.this.havePermission = true;
ToggleLight();
} else {
form.dispatchPermissionDeniedEvent(Camera.this, "ToggleLight",
Manifest.permission.CAMERA);
}
}
});
return;
}
//add here now the code which needs the above permission
}