From edba82b9409513d6181e51a9084a3367d5eeb2a6 Mon Sep 17 00:00:00 2001 From: Bastiaan Olij Date: Thu, 18 Apr 2019 23:16:41 +1000 Subject: [PATCH] Add camera permissions to android (cherry picked from commit fab84c7dff5cafefbfafdffccf6c8fda6a423ef1) --- platform/android/java/src/org/godotengine/godot/Godot.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index 74c6ed2720d..d79075326a6 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -103,6 +103,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC static final int MAX_SINGLETONS = 64; static final int REQUEST_RECORD_AUDIO_PERMISSION = 1; + static final int REQUEST_CAMERA_PERMISSION = 2; private IStub mDownloaderClientStub; private IDownloaderService mRemoteService; private TextView mStatusText; @@ -957,6 +958,12 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC } } + if (p_name.equals("CAMERA")) { + if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { + requestPermissions(new String[] { Manifest.permission.CAMERA }, REQUEST_CAMERA_PERMISSION); + return false; + } + } return true; }