fix new permissions attr

pull/1/head
Dylan McIntyre 8 years ago
parent e87d8feb4c
commit 585105cdf9
  1. 8
      camerakit/src/main/java/com/flurgle/camerakit/CameraView.java

@ -22,6 +22,8 @@ import android.widget.FrameLayout;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; 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_BACK;
import static com.flurgle.camerakit.CameraKit.Constants.FACING_FRONT; import static com.flurgle.camerakit.CameraKit.Constants.FACING_FRONT;
@ -342,10 +344,14 @@ public class CameraView extends FrameLayout {
context = ((ContextWrapper) context).getBaseContext(); context = ((ContextWrapper) context).getBaseContext();
} }
List<String> permissions = new ArrayList<>();
if (requestCamera) permissions.add(Manifest.permission.CAMERA);
if (requestAudio) permissions.add(Manifest.permission.RECORD_AUDIO);
if (activity != null) { if (activity != null) {
ActivityCompat.requestPermissions( ActivityCompat.requestPermissions(
activity, activity,
new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO}, permissions.toArray(new String[permissions.size()]),
CameraKit.Constants.PERMISSION_REQUEST_CAMERA); CameraKit.Constants.PERMISSION_REQUEST_CAMERA);
} }
} }

Loading…
Cancel
Save