public static ConfirmationDialogFragment NewInstance(int message, String[] permissions, int requestCode, int notGrantedMessage) { ConfirmationDialogFragment fragment = new ConfirmationDialogFragment(); Bundle args = new Bundle(); args.PutInt(ARG_MESSAGE, message); args.PutStringArray(ARG_PERMISSIONS, permissions); args.PutInt(ARG_REQUEST_CODE, requestCode); args.PutInt(ARG_NOT_GRANTED_MESSAGE, notGrantedMessage); fragment.Arguments = args; return(fragment); }
protected override void OnResume() { base.OnResume(); if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == Permission.Granted) { mCameraView.Start(); } else if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.Camera)) { ConfirmationDialogFragment.NewInstance( Resource.String.camera_permission_confirmation, new string[] { Manifest.Permission.Camera }, REQUEST_CAMERA_PERMISSION, Resource.String.camera_permission_not_granted).Show(SupportFragmentManager, FRAGMENT_DIALOG); } else { ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.Camera }, REQUEST_CAMERA_PERMISSION); } }