jde
jde

Reputation: 1

Windows phone bug - access denied to device camera

I am facing an issue with the windows phone camera: I am not able to open it using the Titanium.Media.showCamera method. It returns a zero error code (access denied).

I've put all the necessary permissions in the app.xml (correct me if I am wrong):

<windows>
    <manifest>
        <Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10">
            <Capabilities>
            <DeviceCapability Name="webcam"/>
            <uap:Capability Name="picturesLibrary"/>
            </Capabilities>
        </Package>
    </manifest>
</windows>

I've been stuck on this issue for several days, any help would be greatly appreciated.

Thanks

Upvotes: 0

Views: 46

Answers (1)

Prashant Saini
Prashant Saini

Reputation: 3539

Did you try this code to ask Camera permissions first :: ?

    if (Ti.Media.hasCameraPermissions()) {
        takePicture();

    } else {
        Ti.Media.requestCameraPermissions(function(cameraArgs) {
            if (cameraArgs.success) {
                takePicture();

            } else {
                alert('Camera access denied.\nError: ' + cameraArgs.error);
            }
        });
    }

Note that above code requires minimum Ti SDK 5.1.0

Upvotes: 0

Related Questions