3
votes

I am having a frustrating time with writing a Windows Phone App.

I have a WP8.1 Silverlight project. I am then simply trying to initialize the camera. I get an Accessdenied error. Package.appxmanifest file has webcam selected. I have been unable to find similar posts on forums about this issue in particular. Any ideas?

Note: I have great pictures but, I need "at least 10 reputation" to post images :(

Dim WithEvents cam As PhotoCamera

Public Sub New()
    InitializeComponent()
    If PhotoCamera.IsCameraTypeSupported(CameraType.Primary) = True Then
        cam = New PhotoCamera(CameraType.Primary)
    End If

End Sub

Here is the error: An exception of type 'System.UnauthorizedAccessException' occurred in Microsoft.Devices.Camera.ni.dll but was not handled in user code

Additional information: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

I am debugging to the device (lumia 820 with W8.1) and am using VS 2013 for Windows with Update 4.

2

2 Answers

2
votes

It turns out that the WMAppManifest still needs to be set. Unfortunately, the only way to find this or to manipulate it was to go to the directory (outside of visual studio) and then drill into the 'My Project' directory. There I found the WMAppManifest and was able to edit it directly. Added, ID_CAP_ISV_CAMERA and then was able to run/debug as expected.

0
votes

I had the same problem (in my case I was searching in wrong place). I don't know whether you cannot find it or it wasn't bound to your project, but WMAppManifest.xml should be under your-solution/Properies tab.