Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

camera:basic: don't request WRITE_EXTERNAL_STORAGE #1050

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion camera/basic/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
android:versionName="1.0">
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="false"
android:fullBackupContent="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,23 +188,15 @@ public void RequestCamera() {
Log.e(DBG_TAG, "Found legacy camera Device, this sample needs camera2 device");
return;
}
String[] accessPermissions = new String[] {
Manifest.permission.CAMERA,
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
boolean needRequire = false;
for(String access : accessPermissions) {
int curPermission = ActivityCompat.checkSelfPermission(this, access);
if(curPermission != PackageManager.PERMISSION_GRANTED) {
needRequire = true;
break;
}
}
if (needRequire) {
if (ActivityCompat.checkSelfPermission(
this,
Manifest.permission.CAMERA
) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(
this,
accessPermissions,
PERMISSION_REQUEST_CODE_CAMERA);
new String[]{Manifest.permission.CAMERA},
PERMISSION_REQUEST_CODE_CAMERA
);
return;
}
notifyCameraPermission(true);
Expand Down
Loading