From 585105cdf9d86d640a4aaf32263a4c8d37dc131a Mon Sep 17 00:00:00 2001 From: Dylan McIntyre Date: Mon, 3 Apr 2017 23:38:27 -0400 Subject: [PATCH] fix new permissions attr --- .../src/main/java/com/flurgle/camerakit/CameraView.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java b/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java index 058fb652..e71b8055 100644 --- a/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java +++ b/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java @@ -22,6 +22,8 @@ import android.widget.FrameLayout; import java.io.ByteArrayOutputStream; import java.io.File; +import java.util.ArrayList; +import java.util.List; import static com.flurgle.camerakit.CameraKit.Constants.FACING_BACK; import static com.flurgle.camerakit.CameraKit.Constants.FACING_FRONT; @@ -342,10 +344,14 @@ public class CameraView extends FrameLayout { context = ((ContextWrapper) context).getBaseContext(); } + List permissions = new ArrayList<>(); + if (requestCamera) permissions.add(Manifest.permission.CAMERA); + if (requestAudio) permissions.add(Manifest.permission.RECORD_AUDIO); + if (activity != null) { ActivityCompat.requestPermissions( activity, - new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO}, + permissions.toArray(new String[permissions.size()]), CameraKit.Constants.PERMISSION_REQUEST_CAMERA); } }