Add android.permission.CAMERA with Cordova

17,018

I don't think the Camera plugin ever added this permission to AndroidManifest.xml. Looking through the Github repo, WRITE_EXTERNAL_STORAGE was added in June 2013 (CB-3654), but I don't see anything for the camera itself. Not sure why that would be, but you can either add the permission to AndroidManifest.xml yourself or add a config-file directive in your project's config.xml file, for example:

    <config-file target="AndroidManifest.xml" parent="/*" mode="merge">
        <uses-permission android:name="android.permission.CAMERA" />
        <uses-feature android:name="android.hardware.camera" />
        <uses-feature android:name="android.hardware.camera.autofocus" />
    </config-file>
Share:
17,018

Related videos on Youtube

Clemorphy
Author by

Clemorphy

Web Developer from Paris

Updated on September 15, 2022

Comments

  • Clemorphy
    Clemorphy about 1 year

    I am using the latest version of Cordova (6.3.1) and I want the following permission to appear in the AndroidManifest.xml :

    <uses-permission android:name="android.permission.CAMERA" />
    

    Adding this line by hand does not work because the XML is regenerated each time I run the command cordova run android

    I have added the cordova-plugin-camera to my project with

    cordova plugin add cordova-plugin-camera
    

    This plugin does NOT add the CAMERA permission in the AndroidManifest.xml

    I don't know if this is normal

    How can I add this permission to my project ?


    Edit : Usually, Cordova plugins are in charge of adding required permissions into the manifest. The camera plugin does not add this specific permission, I wonder :

    • if the plugin should add this permission (bug ? I have opened an issue on their Jira tracker)
    • if I can add this permission by hand myself, maybe in the Cordova's config.xml
    • Hassan ALi
      Hassan ALi about 7 years
      Please remove and reinstall your camera plugin.Then check your manifist file .Thanks