public void OnPermissionsDenied(int p0, IList <string> p1) { if (EasyPermissions.SomePermissionPermanentlyDenied(currentActivity, p1)) { new AppSettingsDialog.Builder(currentActivity).Build().Show(); } }
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults) { base.OnRequestPermissionsResult(requestCode, permissions, grantResults); var results = grantResults.Select(item => (int)item).ToArray(); EasyPermissions.OnRequestPermissionsResult(requestCode, permissions, results, this); }
public bool SwitchToMicrophoneMode() { ScrollToBottom(); string[] perms = { Android.Manifest.Permission.RecordAudio, Android.Manifest.Permission.WriteExternalStorage }; if (!EasyPermissions.HasPermissions(currentActivity, perms)) { EasyPermissions.RequestPermissions(currentActivity, currentActivity.Resources.GetString(Resource.String.rationale_record_voice), RC_RECORD_VOICE, perms); } return(true); }
public bool SwitchToGalleryMode() { ScrollToBottom(); string[] perms = { Android.Manifest.Permission.ReadExternalStorage }; if (!EasyPermissions.HasPermissions(currentActivity, perms)) { EasyPermissions.RequestPermissions(currentActivity, currentActivity.Resources.GetString(Resource.String.rationale_photo), RC_PHOTO, perms); } mChatView.GetChatInputView().SelectPhotoView.UpdateData(); return(true); }
public void OnStartRecord() { var perms = new string[] { Android.Manifest.Permission.WriteExternalStorage }; if (!EasyPermissions.HasPermissions(_currentActivity, perms)) { EasyPermissions.RequestPermissions(_currentActivity, _currentActivity.Resources.GetString(Resource.String.rationale_camera), 0x0002, perms); } else { string path = Android.OS.Environment.ExternalStorageDirectory.Path + "/voice"; var file = new Java.IO.File(path); if (!file.Exists()) { file.Mkdir(); } mChatView.SetRecordVoiceFile(file.Path, DateTime.Now.ToString("yyyy-MM-dd-hhmmss")); } }
private void RequestPermission() { string[] perms = { Android.Manifest.Permission.WriteExternalStorage, Android.Manifest.Permission.Camera, Android.Manifest.Permission.RecordAudio }; // EasyPermissions.RequestPermissions(this, Resources.GetString(Resource.String.camera_and_location_rationale), RC_CAMERA, perms); var request = new PermissionRequest.Builder(this, RC_CAMERA, perms) .SetRationale("app need some Permissions") .SetPositiveButtonText("OK") .SetNegativeButtonText("reject") .SetTheme(Resource.Style.AlertDialog_AppCompat_Light) .Build(); EasyPermissions.RequestPermissions(request); }
public bool SwitchToCameraMode() { ScrollToBottom(); string[] perms = { Android.Manifest.Permission.WriteExternalStorage, Android.Manifest.Permission.Camera, Android.Manifest.Permission.RecordAudio }; if (!EasyPermissions.HasPermissions(currentActivity, perms)) { EasyPermissions.RequestPermissions(currentActivity, currentActivity.Resources.GetString(Resource.String.rationale_camera), RC_CAMERA, perms); } else { string fileDir = currentActivity.FilesDir.AbsolutePath + "/photo"; mChatView.SetCameraCaptureFile(fileDir, DateTime.Now.ToString("yyyyMMddHHmmss")); } return(true); }
public void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults) { EasyPermissions.OnRequestPermissionsResult(requestCode, permissions, grantResults.Select(item => (int)item).ToArray()); }