private bool checkPermissionForCameraAndMicrophone() { int resultCamera = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA); int resultMic = ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO); return(resultCamera == PackageManager.PERMISSION_GRANTED && resultMic == PackageManager.PERMISSION_GRANTED); }
internal virtual void createVerification(string phoneNumber, string method, bool skipPermissionCheck) { Config config = SinchVerification.config().applicationKey(APPLICATION_KEY).context(ApplicationContext).build(); VerificationListener listener = new MyVerificationListener(this); if (method.Equals(MainActivity.SMS, StringComparison.CurrentCultureIgnoreCase)) { if (!skipPermissionCheck && ContextCompat.checkSelfPermission(this, Manifest.permission.READ_SMS) == PackageManager.PERMISSION_DENIED) { ActivityCompat.requestPermissions(this, new string[] { Manifest.permission.READ_SMS }, 0); hideProgressBar(); } else { mVerification = SinchVerification.createSmsVerification(config, phoneNumber, listener); mVerification.initiate(); } } else { TextView messageText = (TextView)findViewById(R.id.textView); messageText.Text = [email protected]; mVerification = SinchVerification.createFlashCallVerification(config, phoneNumber, listener); mVerification.initiate(); } }
private bool checkPermissionForMicrophone() { int resultMic = ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO); if (resultMic == PackageManager.PERMISSION_GRANTED) { return(true); } return(false); }
private void ensurePermissions(params string[] permissions) { List <string> deniedPermissionList = new List <string>(); foreach (string permission in permissions) { if (PackageManager.PERMISSION_GRANTED != ContextCompat.checkSelfPermission(this, permission)) { deniedPermissionList.Add(permission); } } if (deniedPermissionList.Count > 0) { ActivityCompat.requestPermissions(this, deniedPermissionList.ToArray(), 0); } }