You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Iñaki Vitoria (JIRA)" <ji...@apache.org> on 2016/10/06 14:47:20 UTC

[jira] [Created] (CB-11967) Cordova Plugin default preferences loaded as 'undefined' value inside cordova project.

Iñaki Vitoria created CB-11967:
----------------------------------

             Summary: Cordova Plugin default preferences loaded as 'undefined' value inside cordova project.
                 Key: CB-11967
                 URL: https://issues.apache.org/jira/browse/CB-11967
             Project: Apache Cordova
          Issue Type: Bug
    Affects Versions: 6.3.1
            Reporter: Iñaki Vitoria


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>Cells-mxsofttoken</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.cells.plugins.mxsofttoken.MxSoftTokenPlugin">
                <preference name="samplepref1" value="$SAMPLE_PREF_1" />
                <preference name="samplepref1" value="$SAMPLE_PREF_2" />
                <preference name="samplepref1" 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.cells.plugins.mxsofttoken.MxSoftTokenPlugin">
    <preference name="samplepref1" value="undefined" />
    <preference name="samplepref2" value="undefined" />
    <preference name="samplepref3" value="undefined" />
</preferences>



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org