diff --git a/zxing-android-embedded/res-orig/values/zxing_strings.xml b/zxing-android-embedded/res-orig/values/zxing_strings.xml
index 1f870ebd3..f248861b2 100755
--- a/zxing-android-embedded/res-orig/values/zxing_strings.xml
+++ b/zxing-android-embedded/res-orig/values/zxing_strings.xml
@@ -19,4 +19,5 @@
* This is intended for an Activity that is dedicated to capturing a single barcode and returning * it via setResult(). For other use cases, use DefaultBarcodeScannerView or BarcodeView directly. - * + *
* The following is managed by this class: * - Orientation lock * - InactivityTimer @@ -138,7 +141,7 @@ public CaptureManager(Activity activity, DecoratedBarcodeView barcodeView) { /** * Perform initialization, according to preferences set in the intent. * - * @param intent the intent containing the scanning preferences + * @param intent the intent containing the scanning preferences * @param savedInstanceState saved state, containing orientation lock */ public void initializeFromIntent(Intent intent, Bundle savedInstanceState) { @@ -242,20 +245,47 @@ private void openCameraWithPermission() { == PackageManager.PERMISSION_GRANTED) { barcodeView.resume(); } else if (!askedPermission) { + showPermissionRequiredDialog(); + askedPermission = true; + } // else wait for permission result + } + + private void showPermissionRequiredDialog() { + Dialog dialog = new AlertDialog.Builder(activity) + .setMessage(R.string.camera_permission_request_explanation) + .setPositiveButton(android.R.string.ok, (dialogInterface, i) -> { + dialogInterface.cancel(); + requestPermissionOrNavigateToSettings(); + }) + .setNegativeButton(android.R.string.no, (dialogInterface, i) -> { + dialogInterface.cancel(); + activity.finish(); + }) + .create(); + dialog.show(); + } + + private void requestPermissionOrNavigateToSettings() { + if (ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.CAMERA)) { + Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); + intent.addCategory(Intent.CATEGORY_DEFAULT); + intent.setData(Uri.parse("package:" + activity.getPackageName())); + activity.startActivity(intent); + } else { ActivityCompat.requestPermissions(this.activity, new String[]{Manifest.permission.CAMERA}, cameraPermissionReqCode); - askedPermission = true; - } // else wait for permission result + } } /** * Call from Activity#onRequestPermissionsResult - * @param requestCode The request code passed in {@link androidx.core.app.ActivityCompat#requestPermissions(Activity, String[], int)}. - * @param permissions The requested permissions. + * + * @param requestCode The request code passed in {@link androidx.core.app.ActivityCompat#requestPermissions(Activity, String[], int)}. + * @param permissions The requested permissions. * @param grantResults The grant results for the corresponding permissions - * which is either {@link android.content.pm.PackageManager#PERMISSION_GRANTED} - * or {@link android.content.pm.PackageManager#PERMISSION_DENIED}. Never null. + * which is either {@link android.content.pm.PackageManager#PERMISSION_GRANTED} + * or {@link android.content.pm.PackageManager#PERMISSION_DENIED}. Never null. */ public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { if (requestCode == cameraPermissionReqCode) { @@ -302,7 +332,7 @@ public void onSaveInstanceState(Bundle outState) { /** * Create a intent to return as the Activity result. * - * @param rawResult the BarcodeResult, must not be null. + * @param rawResult the BarcodeResult, must not be null. * @param barcodeImagePath a path to an exported file of the Barcode Image, can be null. * @return the Intent */