cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Bowser <bows...@gmail.com>
Subject Re: get config.xml data from js
Date Fri, 28 Feb 2014 21:57:57 GMT
BTW: android_res and android_assets are special Android URIs that
access the APK directly.  They are read-only directories, and they
basically are used to access static files.  They also tend to be buggy
as all hell, so YMMV.

On Fri, Feb 28, 2014 at 1:54 PM, Joe Bowser <bowserj@gmail.com> wrote:
> Can't you just use an XHR to this URI:
> file://android_res/xml/config.xml?
>
>
>
> On Fri, Feb 28, 2014 at 1:48 PM, Jesse <purplecabbage@gmail.com> wrote:
>> They seem to be in the root iOS, android, and windows phone.
>>
>> NSString* path = [[NSBundle mainBundle] pathForResource:@"config" ofType:
>> @"xml"];
>>
>> int id = action.getResources().getIdentifier("config", "xml", action.
>> getClass().getPackage().getName());
>>
>> *StreamResourceInfo streamInfo = Application.GetResourceStream(new
>> Uri("config.xml", UriKind.Relative));*
>>
>>
>>
>> @purplecabbage
>> risingj.com
>>
>>
>> On Fri, Feb 28, 2014 at 1:21 PM, Andrew Grieve <agrieve@chromium.org> wrote:
>>
>>> config.xml isn't in the www/ on all platforms.
>>>
>>>
>>> On Fri, Feb 28, 2014 at 4:15 PM, Jesse <purplecabbage@gmail.com> wrote:
>>>
>>> > function readConfig() {
>>> >     var xhr = new XMLHttpRequest();
>>> >     xhr.addEventListener("load", function () {
>>> >         var parser = new DOMParser();
>>> >         var doc = parser.parseFromString(xhr.responseText,
>>> > "application/xml");
>>> >         alert("Description : " +
>>> > doc.getElementsByTagName("description").item(0).textContent);
>>> >     });
>>> >     xhr.open("get", "../config.xml", true);
>>> >     xhr.send();
>>> > }
>>> >
>>> > @purplecabbage
>>> > risingj.com
>>> >
>>> >
>>> > On Fri, Feb 28, 2014 at 1:06 PM, Michal Mocny <mmocny@chromium.org>
>>> wrote:
>>> >
>>> > > Now that I look a bit deeper, that plugin I only returns <preferences>
>>> > > specifically, not the entire contents of config.xml (name is not a
>>> > > <preference>).
>>> > >
>>> > > It also does not currently implement a way to inspect all preferences,
>>> > just
>>> > > has a way to get the value for a specific one.
>>> > >
>>> > > I do think it would be a good idea to just have one core plugin
>>> (perhaps
>>> > > extend that one I linked) to include all config file values.
>>> > >
>>> > > Filed: https://issues.apache.org/jira/browse/CB-6139
>>> > >
>>> > > -Michal
>>> > >
>>> > >
>>> > > On Fri, Feb 28, 2014 at 3:57 PM, Michal Mocny <mmocny@chromium.org>
>>> > wrote:
>>> > >
>>> > > > David already wrote a plugin for this a few months ago for us
to use
>>> in
>>> > > > the test harness:
>>> > > >
>>> > >
>>> >
>>> https://github.com/apache/cordova-labs/tree/cdvtest/cordova-plugin-appsettings
>>> > > >
>>> > > > I think he planned on proposing it for core but there was never
>>> really
>>> > a
>>> > > > reason for it.  I guess now's a good time to get that going.
>>> > > >
>>> > > > On Fri, Feb 28, 2014 at 3:39 PM, Andrew Grieve <agrieve@chromium.org
>>> > > >wrote:
>>> > > >
>>> > > >> Certainly a reasonable thing to want to do, but there's no
way
>>> > currently
>>> > > >> short of writing a custom plugin, or a post-prepare hook.
>>> > > >>
>>> > > >>
>>> > > >>
>>> > > >> On Fri, Feb 28, 2014 at 3:34 PM, Axel Nennker <
>>> ignisvulpis@gmail.com>
>>> > > >> wrote:
>>> > > >>
>>> > > >> > Hi,
>>> > > >> >
>>> > > >> > I fear this is a stupid question but I could not find
the answer
>>> in
>>> > > the
>>> > > >> > cordova docs or on the net or reading the source (Luke).
>>> > > >> >
>>> > > >> > As an app developer and cordova user how do I get data
from
>>> > > config.xml?
>>> > > >> >
>>> > > >> > We want to add an "about" page to an cordova app and
could not
>>> find
>>> > a
>>> > > >> > simple javascript way to get to things like author, id,
version,
>>> > name
>>> > > or
>>> > > >> > description from config.xml.
>>> > > >> > Writing a plugin seems to be overkill. Using the file
or
>>> > file-transfer
>>> > > >> > plugins is heavy lifting too.
>>> > > >> >
>>> > > >> > Shouldn't there be a way to write cordova.config.name
to get the
>>> > > >> contents
>>> > > >> > of the name element in config.xml?
>>> > > >> >
>>> > > >> > Someone added "metadata" to cordova_plugins.js.
>>> > > >> > Maybe we could add something similar to cordova.js too?
>>> > > >> >
>>> > > >> > Does this make sense?
>>> > > >> >
>>> > > >> > Thanks
>>> > > >> > Axel
>>> > > >> >
>>> > > >>
>>> > > >
>>> > > >
>>> > >
>>> >
>>>

Mime
View raw message