MonoTouch检测iPhone上是否启用了麦克风

时间:2014-07-07 19:02:54

标签: xamarin.ios

我的应用正在使用麦克风录制语音。我如何检测(来自Monotouch代码)是否启用了设置(设置 - 隐私 - 麦克风)中的麦克风。

用户可以转到“设置”并禁用“麦克风”。如果是,那么我想提醒用户启用麦克风。

1 个答案:

答案 0 :(得分:1)

AVAudioSession newsession = AVAudioSession.SharedInstance;

newsession.RequestRecordPermission(delegate(bool granted) {
  // if granted is true you have access, otherwise you can display
  // a message to the user asking them to enable the mic
});