Understand the basic elements of the config.xml file. This file is used by PhoneGap build to control how the mobile application is compiled by the service. He looks defining your application's name, the various version codes, and it's application id.
- [Voiceover] With Visual Studio Code open, I've navigated to the SAMOCA-Demo-Start for chapter four. We can see our structure over on the left, and the index HTML file on the right. We need to create a blank text file within my editor. This file must be at the same level as our index.HTML file, otherwise phonegap-build will not be able to locate it and apply your settings. I'm going to go ahead and right click, say New File, and label it config.XML.
Now rather than watching me type a bunch of stuff out, I actually have a predefined snippets file that I'll be copy and pasting code elements into this config.XML file, saving a little time. You'll also find that file within your exercise folder. I'm going to go ahead and open that as well. Since this is an .XML file, our first line will need to be the XML decoration. So, that is our first line here, we will copy that, and paste that in as well. You can see since Code knows this is an .XML file, we're actually going to get some nice color co-tinting as we move through here.
Next, we will define our widget node in the file. The phonegap-build config.XML file is based on the w3c, which is specification. Our widget node has two .XML name spaces to find. Both one for the w3c, and one for Phonegap itself. These values are the same from app to app. Next, we're going to need to change the ID attribute to match the value of our application. Here, we have it set up for com.lynda.samoca.
Typically, these are set in a reverse domain notation. This is a critical value, as this is the actual ID that your app will be bound to for both apps stores, as well as some plug-in configurations. Next, the version code attribute is only used by Android. This is an integer value, and is typically increased by one for each release of our app. We will set ours to one. The final attribute to note here in the widget node is the version number.
This value should follow the typical major, minor, and point format. Since this is our first release, I will set it too 1.0.0. Next, we need to add the name node. This node will contain the display name of our application. Here we're just going to set it to SAMOCA. We can also include a description node to our file, as well as an author tag. We'll grab both of those. The description node here is not the same description that you will need to supply when you submit your app to the various app stores.
It is here as part of the specification. Here, we'll just set it to something meaningful like a mobile guide to the SAMOCA. The final node for our initial config.XML file will be the author node. This node has two attributes. One for your email, and one for your website. I will set it to samoca.org, and the email to firstname.lastname@example.org. Then within that node I'll just go ahead and put my name as well, Chis Griffith. We can now close our widget tag, and save our file.
Now, when we upload our app to phonegap-build, it will use this information in our config.XML file to generate our application.
In this course, Chris Griffith introduces the PhoneGap ecosystem and the basics of PhoneGap Build. He shows how to set up an account for development and create, configure, and compile your first project with PhoneGap Build. Once you've mastered these fundamentals, Chris shows how to extend your app plugins, debug your app, and then prep it for release in the App Store, Google Play store, or Windows Store.
- What is PhoneGap Build?
- Setting up for Android or iOS development
- Creating a PhoneGap Build project
- Exploring the HTML structure of the app
- Defining build platforms and parameters
- Adding icons and splash screens
- Building the app via a ZIP file or GitHub
- Extending an app with plugins
- Debugging a PhoneGap Build app
- Preparing for release