src/android/src/gmvScanner/BarcodeCaptureActivity.java
/**
     * Handles the requesting of the camera permission.  This includes
     * showing a "Snackbar" message of why the permission is needed then
     * sending the request.
     */
Handles the requesting of the camera permission.  This includes
showing a "Snackbar" message of why the permission is needed then
sending the request.
Handles the requesting of the camera permission . This includes showing a " Snackbar " message of why the permission is needed then sending the request .
private void requestCameraPermission() {
        Log.w(TAG, "Camera permission is not granted. Requesting permission");
        final String[] permissions = new String[]{Manifest.permission.CAMERA};
        if (!ActivityCompat.shouldShowRequestPermissionRationale(this,
                Manifest.permission.CAMERA)) {
            ActivityCompat.requestPermissions(this, permissions, RC_HANDLE_CAMERA_PERM);
            return;
        }
        final Activity thisActivity = this;
        View.OnClickListener listener = new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ActivityCompat.requestPermissions(thisActivity, permissions,
                        RC_HANDLE_CAMERA_PERM);
            }
        };
        findViewById(getResources().getIdentifier("topLayout", "id", getPackageName())).setOnClickListener(listener);
        Snackbar.make(mGraphicOverlay, getResources().getIdentifier("permission_camera_rationale", "string", getPackageName()),
                Snackbar.LENGTH_INDEFINITE)
                .setAction(getResources().getIdentifier("ok", "string", getPackageName()), listener)
                .show();
    }
private void requestCameraPermission ( ) { Log . w ( TAG , "Camera permission is not granted. Requesting permission" ) ; final String [ ] permissions = new String [ ] { Manifest . permission . CAMERA } ; if ( ! ActivityCompat . shouldShowRequestPermissionRationale ( this , Manifest . permission . CAMERA ) ) { ActivityCompat . requestPermissions ( this , permissions , RC_HANDLE_CAMERA_PERM ) ; return ; } final Activity thisActivity = this ; View . OnClickListener listener = new View . OnClickListener ( ) { @ Override public void onClick ( View view ) { ActivityCompat . requestPermissions ( thisActivity , permissions , RC_HANDLE_CAMERA_PERM ) ; } } ; findViewById ( getResources ( ) . getIdentifier ( "topLayout" , "id" , getPackageName ( ) ) ) . setOnClickListener ( listener ) ; Snackbar . make ( mGraphicOverlay , getResources ( ) . getIdentifier ( "permission_camera_rationale" , "string" , getPackageName ( ) ) , Snackbar . LENGTH_INDEFINITE ) . setAction ( getResources ( ) . getIdentifier ( "ok" , "string" , getPackageName ( ) ) , listener ) . show ( ) ; }
Handles the requesting of the camera permission.
Handles the requesting of the camera permission .