Esempio n. 1
0
 private void HandleMicPermission()
 {
     if (!(PermissionsHelper.HasPermission(Activity, ConstantsAndTypes.AppPermission.UseMicrophone) && PermissionsHelper.PermissionGranted(Activity, ConstantsAndTypes.AppPermission.UseMicrophone)))
     {
         if (_speakAffirmation != null)
         {
             _speakAffirmation.SetImageResource(Resource.Drawable.micgreyscale);
             _speakAffirmation.Enabled = false;
         }
     }
 }
 private void CheckMicPermission()
 {
     try
     {
         if (!(PermissionsHelper.HasPermission(this, ConstantsAndTypes.AppPermission.UseMicrophone) && PermissionsHelper.PermissionGranted(this, ConstantsAndTypes.AppPermission.UseMicrophone)))
         {
             AttemptPermissionRequest();
         }
     }
     catch (Exception e)
     {
         Log.Error(TAG, "CheckMicPermission: Exception - " + e.Message);
         ErrorDisplay.ShowErrorAlert(this, e, "Checking Microphone permission", "StructuredPlanRelationshipsDialogActivity.CheckMicPermission");
     }
 }
        private void ShowPermissionRationale()
        {
            try
            {
                if (GlobalData.Settings.Find(setting => setting.SettingKey == "NagMic").SettingValue == "True")
                {
                    if (!(PermissionsHelper.HasPermission(this, ConstantsAndTypes.AppPermission.UseMicrophone) && PermissionsHelper.PermissionGranted(this, ConstantsAndTypes.AppPermission.UseMicrophone) == true))
                    {
                        PermissionResultUpdate(Permission.Denied);
                        Toast.MakeText(this, Resource.String.MicrophonePermissionDenialToast, ToastLength.Short).Show();
                    }
                    return;
                }

                AlertHelper alertHelper = new AlertHelper(this);

                alertHelper.AlertIconResourceID  = Resource.Drawable.SymbolInformation;
                alertHelper.AlertMessage         = GetString(Resource.String.RequestPermissionUseMicrophoneAlertMessage);
                alertHelper.AlertNegativeCaption = GetString(Resource.String.ButtonNoCaption);
                alertHelper.AlertPositiveCaption = GetString(Resource.String.ButtonYesCaption);
                alertHelper.AlertTitle           = GetString(Resource.String.RequestPermissionUseMicrophoneAlertTitle);
                alertHelper.InstanceId           = "useMic";
                alertHelper.ShowAlert();
            }
            catch (Exception e)
            {
                Log.Error(TAG, "ShowPermissionRationale: Exception - " + e.Message);
                ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorMicPermissionShowRationalAlert), "StructuredPlanRelationshipsDialogActivity.ShowPermissionRationale");
            }
        }
 private void CheckMicPermission()
 {
     try
     {
         if (!(PermissionsHelper.HasPermission(Activity, ConstantsAndTypes.AppPermission.UseMicrophone) && PermissionsHelper.PermissionGranted(Activity, ConstantsAndTypes.AppPermission.UseMicrophone)))
         {
             Toast.MakeText(Activity, Resource.String.MicrophonePermissionDenialToast, ToastLength.Short).Show();
             if (_recordAudioButton != null)
             {
                 _recordAudioButton.Enabled = false;
             }
         }
     }
     catch (Exception e)
     {
         Log.Error(TAG, "CheckMicPermission: Exception - " + e.Message);
         ErrorDisplay.ShowErrorAlert(Activity, e, "Checking Microphone permission", "VoiceRecordingDialogFragment.CheckMicPermission");
     }
 }