问题
I am trying to use the camera capability in my xamarin android app using the below code.
Intent intent = new Intent(MediaStore.ActionImageCapture);
StartActivityForResult(intent, 0);
I have enabled camera in the Android Manifest and followed all that is mentioned in this tutorial.
However on running the code I get this error Camera Error : Cant connect to the Camera.
Also I get the same error when opening the standard camera app in the emulator
I tried out enabling camera using this link & variations of it, but no luck
Finally I noticed this on www.xamarin.com/android-player,
"Use your computer’s webcam to simulate a back and front-facing camera on your device. (Coming soon)"
So my question is does xamarin android player support using camera, if yes how do I fix this issue to see emulated camera if not my pc webcam ?
AVD - android 4.4.2 - API 19
回答1:
I use Xamarin and just faced the same problem, when I was following this same tutorial.
I fixed it by going to Tools > Google Emulator Manager, then selected the device I was emulating and then clicked "Edit...".
In the new window Edit Android Virtual Device (AVD) I went to hardware section at the bottom and changed 'Configures Camera facing front' option to "Emulated".
It worked for me so I thought I should post here in case that helps.
来源:https://stackoverflow.com/questions/36810278/xamarin-android-player-camera-error-cant-connect-to-camera