diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-04-19 11:27:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-19 11:27:11 +0200 |
commit | f20c9c25ebddcef07daaa8788d8ff33679aa2aef (patch) | |
tree | 158cfd40a19ef8da8286bcf319c0dd137bc53106 /platform/android | |
parent | d1c26674eb5827311e6b249f56e1e66b70806bb3 (diff) | |
parent | fab84c7dff5cafefbfafdffccf6c8fda6a423ef1 (diff) |
Merge pull request #28164 from BastiaanOlij/AndroidCameraPermission
Add camera permissions to android
Diffstat (limited to 'platform/android')
-rw-r--r-- | platform/android/java/src/org/godotengine/godot/Godot.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index 5ef72bab6c..374d40463a 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -99,6 +99,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; @@ -956,6 +957,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; } |