Search code examples
cordovauwpwindows-10phonegap-pluginscordova-plugins

Update appmanifest capabilities, visual elements from cordova plugin windows 10


I need to update package.appmanifest for windows 10 app via cordova plugin using cmd line. Below is my code snippet in plugin.xml that should update the appmanifest but doesn't work.

  <config-file target="package.appxmanifest" parent="/Package/Capabilities">

     <DeviceCapability Name="webcam"/>
     <DeviceCapability Name="microphone"/>

</config-file>

Windows version: 4.4.3

Cordova version: 6.4.0

Also please let me know how to change app icons? I have tried following but that also doesn't work.

 <config-file target="package.appxmanifest" parent="/Package/Applications/Application">

  <uap:VisualElements
    DisplayName="MyApp"
    Description="My description"
    BackgroundColor="#464646"
    Square150x150Logo="images\Square150x150Logo.png"
    Square44x44Logo="images\Square44x44Logo.png">

    <uap:SplashScreen Image="images\splashscreen.png" />
    <uap:DefaultTile ShortName="MyAppName"
                     Square310x310Logo="images\Square310x310Logo.png"
                     Square71x71Logo="images\Square71x71Logo.png"
                     Wide310x150Logo="images\Wide310x150Logo.png" />

  </uap:VisualElements>
</config-file>

Update:

I have also tried with putting target as target="package.windows10.appxmanifest" and that also didn't work.


Solution

  • I need to update package.appmanifest for windows 10 app via cordova plugin using cmd line. Below is my code snippet in plugin.xml that should update the appmanifest but doesn't work.

    Please make sure you have added config-file in the right place:

    An Example of plugin.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
           id="cordova-plugin-test"
      version="1.0.0">
    <name>TestPlugin</name>
    <description>Cordova Test Plugin</description>
    <license>Apache 2.0</license>
    
    
    <!-- windows -->
    <platform name="windows">
        <config-file target="package.appxmanifest" parent="/Package/Capabilities">
            <Capability Name="picturesLibrary" />
            <DeviceCapability Name="webcam" />
        </config-file>
    </platform>
    
    </plugin>
    

    Notes: After build, you can check the result in platforms\windows\package.appxmanifest.

    Also please let me know how to change app icons?

    To change the app icons, please refer to Customize app icons.