O'Reilly logo

Xamarin Mobile Development for Android Cookbook by Matthew Leibowitz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required