Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-11967

Cordova Plugin default preferences loaded as 'undefined' value inside cordova project.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 6.3.1
    • None
    • cordova-lib

    Description

      Scenario
      ========

      Creating a new cordova Plugin.

      Setting preferences and default values in different platforms inside plugin.xml file.

      Once the plugin is added to the project and built, resultant DEFAULT values aren´t loaded and set to 'undefined'.

      PROJECT SAMPLE CODE PROVIDED
      ============================

      Only relevant lines of code are included, everything else has been removed since is automatically generated by cordova.

      <?xml version="1.0" encoding="utf-8"?>
      <plugin id="cordova-plugin-sampleplugin" version="0.0.4"

      xmlns="http://www.phonegap.com/ns/plugins/1.0"
      xmlns:android="http://schemas.android.com/apk/res/android">

      <name>Plugin</name>
      <preference name="SAMPLE_PREF_1" default="value1" />
      <preference name="SAMPLE_PREF_2" default="value2" />
      <preference name="SAMPLE_PREF_3" default="value3" />

      <engines>
      <engine name="cordova" version=">=3.4.0" />
      </engines>

      <asset src="www/SamplePlugin.js" target="js/SamplePlugin.js" />

      <platform name="android">

      <config-file parent="/*" target="res/xml/config.xml">
      <preferences name="com.sample.plugin">
      <preference name="samplepref1" value="$SAMPLE_PREF_1" />
      <preference name="samplepref2" value="$SAMPLE_PREF_2" />
      <preference name="samplepref3" value="$SAMPLE_PREF_3" />
      </preferences>
      </config-file>
      </platform>
      </plugin>

      Given the following preference configuration and default values PROVIDED

      the resultant config.xml file inside res/xml/config.xml (android example) contains all default values set to 'undefined'

      <preferences name="com.sample.plugin">
      <preference name="samplepref1" value="undefined" />
      <preference name="samplepref2" value="undefined" />
      <preference name="samplepref3" value="undefined" />
      </preferences>

      Attachments

        Issue Links

          Activity

            People

              Nikita Matrosov Nikita Matrosov
              ivitoriag@gmail.com Iñaki Vitoria
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: