Creating a camera app

Sometimes the basic camera intents aren't enough, or we are creating an augmented reality game, and we want to process the images as the camera streams them.

How to do it...

To create a camera app, or some other app that displays a live preview from the camera hardware, we need to set up several things similar to playing a video, we must implement the ISurfaceHolderCallback interface, which will manage the live preview:

  1. As with using intents to start the camera, we need to check for the existence of a camera on the device. Additionally, we will need to request permission to manage the camera, as follows:
    [assembly: UsesPermission(Manifest.Permission.Camera)]
  2. Next, we will need a surface to display the camera preview, and to do ...

Get Xamarin Mobile Development for Android Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.