While trying to debug a Phonegap error message ("Call to OpenGL ES api with no current context" which doesn't appear to be causing any problems), I came across a newer version of the cordova.xml file which ships with PhoneGap 1.6 and has the following line in it:
<preference name="classicRender" value="true" />
Adding this line to my copy of cordova.xml didn't do anything. But then I also noticed the comments and other lines in that file regarding access origins, and I noticed that my app has the access origin set to 127.0.0.1 but all my code is on a remote server, and this doesn't seem to matter.
I searched for documentation but didn't find any.
So I have to ask: what is the cordova.xml file for, what directives can be put in it, and what are they supposed to do?
Apache Cordova is a framework for building mobile apps with HTML, CSS, and JavaScript. You can target multiple platforms with one code base.
config. xml is a global configuration file that controls many aspects of a cordova application's behavior. This platform-agnostic XML file is arranged based on the W3C's Packaged Web Apps (Widgets) specification, and extended to specify core Cordova API features, plugins, and platform-specific settings.
The plugin element is the plugin manifest's top-level element. The plugin namespace, http://apache.org/cordova/ns/plugins/1.0 . If the document contains XML from other namespaces, such as tags to be added to the AndroidManifest. xml file in the case of Android, those namespaces should also be included in the element.
The Cordova config. xml file is the global configuration file of the application. The Cordova configuration file is a mandatory XML file that contains application metadata, and is stored in the root directory of the app. The file is automatically generated when you create a Cordova application.
The cordova.xml file is a configuration file that specifies settings for whitelisted urls, log level, and rendering. The file was previously called phonegap.xml and was renamed when Adobe/Nitobi donated the PhoneGap codebase to the Apache Software Foundation (ASF) for incubation.
The file includes three settings.
First is:
<access origin>
which specifies an approved list of URLs that can be loaded. These urls are added to the whitelist cache in the DroidGap class. Only URLs on the whitelist can be loaded in the Cordova webview or a new browser instance.
Second is:
<log level>
which specifies log level for debugging on Android . It can be set to ERROR, WARN, INFO, DEBUG or VERBOSE (default=ERROR).
Third is:
<preference name="classicRender" />
which sets the field
private boolean classicRender;
in the DroidGap class. The only reference to what it actually does that I can find is in this commit to Cordova:
if(android.os.Build.VERSION.SDK_INT < 14 && this.classicRender)
{
//This hack fixes legacy PhoneGap apps
//We should be using real pixels, not pretend pixels
...
Perhaps it's more useful to know that it's apparently being removed since it doesn't work properly.
The cordova.xml is parsed in the DroidGap class, in the loadConfiguration() method:
private void loadConfiguration() {
int id = getResources().getIdentifier("cordova", "xml", getPackageName());
...
XmlResourceParser xml = getResources().getXml(id);
etc...
See line 1252 in the DroidGap class for full loadConfiguration() method. All three attributes are parsed but as per above link it appears the classicRender setting doesn't work and can be ignored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With