Wednesday, January 28, 2015

Interactive Config Guide for PhoneGap/Cordova

Screen Shot 2015-01-28 at 1.48.12 PM One of the challenges we face as hybrid app developers is determining which configuration settings to use for any given app due to variances in operating systems and browser rendering engines across platforms. The config.xml file located in the root of your PhoneGap/Cordova apps when you create an app can have a variety of content that can be confusing to developers. The documentation is often less than crystal clear as well. As a result, I’ve created a new interactive guide to document it and help people understand what each element/preference means, defaults and valid values for them as well as noting required fields and supported platforms. You can hover over the elements on the left side in the config.xml file and the details for it will display on the right. You can click the buttons to display the different preferences by platform. I’m continuing to test and add more details further as well.



This guide is specific to those properties available to you when building your app with the PhoneGap or Cordova CLI. If you are using PhoneGap Build, you will still be using this config.xml file as a configuration vehicle, however the names and support for different elements and preferences are completely different than when using the CLI’s and not to be confused. I also highly recommend the ConfiGAP tool or refer to the PhoneGap Build documentation Configuration section specifically for those details.


While on the subject of configuration, I also think it’s useful to explain a couple of things going on behind the scenes in terms of configuration content and your apps for at least iOS and Android in case there are some that want to dig in deeper.


iOS


If you look at the yourApp/platforms/ios/CordovaLib/ClassesCleaver folder in your project you’ll find classes where your config.xml file is used. It is parsed specifically in the CDVConfigParser.m class and those properties are then set as needed in the CDVViewController.m class. You should also be aware of the <projectName>.plist file that is used by your iOS apps. It’s located in the .../platforms/ios/MyProject/Resources/MyProject.plist path and has settings that will affect orientation and other settings you may feel the need to modify at some point.


Android


You will also find a CordovaLib folder in the project platform and the class used for parsing them on Android is ConfigXmlParser.java. The class that processes the settings once they’ve been parsed is CordovaActivity.java . You should also be aware of the <AndroidManifest.xml file that is used by your Android apps. It’s located in the .../platforms/android/MyProject/Resources/MyProject.plist path and has settings that will affect orientation and other settings you may feel the need to modify at some point.


Please feel free to provide any feedback on your own use with these preferences and settings if you have more information to contribute from your own experience.






by Holly Schinsky via Devgirl's Weblog

No comments:

Post a Comment