Forum Xamarin.Forms

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

In-App camera function

ganesh96ganesh96 Member ✭✭✭

Hi all,

My app uses the standard camera for taking pictures (iOS and Android), but since I want to change the behaviour of the camera itself I need to create an in-app camera. I took a look at the ConferenceVision example, which seems pretty good for me: https://github.com/microsoft/ConferenceVision . The user in my my app has to take a picture, view it, and if the picture is good enough send it to an API.

Problem is that I cannot get it working in my app. It doesn't show the camera permissions somehow (it doesn't ask for any permissions), which causes the app to not show the camera.

I made a simple demo in the attachment, I hope someone can help me with this.

Tagged:

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    We need to add required permission in each specific platform .

    Android :

    Add Camera option in Manifest.

    iOS :

    Add NSCameraUsageDescription in info.plist .

  • ganesh96ganesh96 Member ✭✭✭

    Hi @ColeX ,

    I forgot to put the permissions in this small demo, but not in my own app. I added the permissions in this small demo as well, but without any success. Please find the updated demo in the attachment.

  • ColeXColeX Member, Xamarin Team Xamurai

    I test the project with no problem at asking permission .

    Please delete you app from device first and reinstall ,then try again .

    The permission dialog shows as expected , but the camera view is still not working because you miss something in project , i don't see the code calling camera at all in the project , check the link you provided above , it has a class named CameraPreviewRenderer which call camera function inside it .

    https://github.com/microsoft/ConferenceVision/blob/master/ConferenceVision/ConferenceVision.Android/Renderers/CameraPreviewRenderer.cs

  • ganesh96ganesh96 Member ✭✭✭

    Hi @ColeX ,

    I added the CameraPreviewRenderer now, but now the app crashes because something was not set to an instance of an object (no code to show).

Sign In or Register to comment.