Search code examples
c#androidaudioxamarin.formsmediarecorder

Xamarin.Forms App MediaRecorder doesn't run on Jiayu S3


I'm developing a Xamarin.Forms App using the MediaRecorder to record audiofiles. I've testet it on the following devices:

  • Huawei P9 (Android 7.0)
  • Samsung Galaxy A5 (2017) (Android 6.0.1)
  • Sony Xperia Z3 (Android 6.0.1)

There it runs without problems. However, on a Jiayu S3 (Android Version 7.1.2) the following line of code fails:

var mediaRecorder = new MediaRecorder();

There is no error shown, although i've enabled all exception types in visual studio. Also, the device log doesn't show any errors. The MediaRecorder is simply not instanciated. The calling method is returned and the media recorder is null.

The permissions given are:

  • External Storage
  • Microphone

What am I missing?


Solution

  • I've solved the problem. Seems like another app on the smartphone was somehow locking the microphone. However, there was no error showing up, which is kind of strange. I just restarted the phone and the MediaRecorder worked after I did so.

    So if you're MediaRecorder is not working as expected, check if another app is locking the microphone, try to close all other apps on the phone you're testing on or restart the phone.