How to check the supported Camera Type in Windows Phone?

If you are a WPDev and building Windows Phone app and/or game that uses primary or secondary (front facing camera), you might need to check whether the device supports either or both of them. Windows Phone SDK provides APIs to check for supported camera type.


In this blog post, we will discuss about this API and learn how to know whether the phone supports either or both of those camera types.


The abstract class “Camera” present under the namespace “Microsoft.Devices” provides you the required API to check whether the Windows Phone device supports Primary Camera or Front Facing Camera. The Camera class contains a static method named “IsCameraTypeSupported(CameraType type)” that returns a boolean value indicating whether the passed CameraType is available in the device. The parameter of CameraType could be either “Primary” or “FrontFacing”.


Here is the code to know the supported camera type in a Windows Phone device:


// this will return boolean value indicating whether the device has Primary Camera
var hasPrimaryCamera = Camera.IsCameraTypeSupported(CameraType.Primary);


// this will return boolean value indicating whether the device has Front Facing Camera var hasFrontFacingCamera = Camera.IsCameraTypeSupported(CameraType.FrontFacing);


While using the camera APIs in Windows Phone, you might get an “UnauthorizedAccessException” as shown below, if you did not configure your project to apply proper capability settings:


UnauthorizedAccessException when accessing Camera APIs in Windows Phone


To do this, open the WMAppManifest.xml file and navigate to the Capabilities tab as shown in the below screenshot. There you will find a checkbox named “ID_CAP_ISV_CAMERA” listed under the Capabilities. Mark this capability as checked and you will be good to go.


Enable the ID_CAP_ISV_CAMERA Capability in Windows Phone application


Did this post help you? Don’t forget to share it with your friends and network. Subscribe to my blog’s RSS Feed to get instant update on new blog post. Are you available on Twitter or Facebook? I am available there too. Do connect with me to get regular updates on various technical/non-technical posts.


If you have come this far, it means that you liked what you are reading. Why not reach little more and connect with me directly on Twitter , Facebook , Google+ and LinkedIn . I would love to hear your thoughts and opinions on my articles directly. Also, don't forget to share your views and/or feedback in the comment section below.


  1. great tips to find supported camera type in win phone. Thanks for sharing this post.


© 2008-2016 - Microsoft Technology Blog for developers and consumers | Designed by Kunal Chowdhury
Back to top