In this video, Chris Griffith shows how you define the use of PhoneGap plugins through additions to the config.xml file. This can include plugins that provide access to the mobile device's camera, geolocation, and native dialogs.
- [Voiceover] Switching back to our text editor, in this case, code. We're going to make some changes to the Samoca app. To include several of these core plug-ins or app to function correctly. These are going to include camera, device, dialogues, geo-location, in-app browser, network information, splash screen, status bar and white list. So, I have it listed out in our sentence.txt file. Scroll down, we will see our collection of plug-ins.
Let me copy that. And add that back in to our config.xml file. I'll paste that in right after our permissions. And go ahead and save our file. So here we have our plug-in, the name, defining which plug-in we're going to use, the version, defined by the spec attribute, and the source. Phone gap build will now include these plug-ins into our build process. For Windows and Android, this means the appropriate, proper permissions to inform the user of the features the app will use, will now be displayed.
Now adding these plug-ins, just enables the device functionality to be exposed to the app. We will still need to write the code to access these functions. We'll explore that in a later video. A quick note, if you see a reference to a plug-in naming scheme like org.apache.cordova, then you're looking at an outdated reference. The proper format for all the mpm hosted plug-ins is, cordova-plugin- and then the plug-in name. So, remember that when you're looking for a source code and an example code.
Let's go ahead and build a parision of this app, so I can show you the plug-in screen, on the app detail screen. So let me hide this. Here is the app that we just saved. Let's go ahead, compress it. So we can upload it to the phone gap build system. I have the build right here. We'll click update code. Going to choose a file, going to move into the appropriate folder. Select the zip file we just created.
Open, and click Upload. Our application's been updated and a build queue is now underway. We can actually flip forward to Plug-ins. This screen will install the installed plug-ins that were defined in our config.xml file. You can see the source location, the various version options, and the supported platforms for that plug-in. And as an added bonus, they also give us snippets to insert into our config.xml file. If there's ever an issue with a bit of plug-in code, check here first, to make sure phone gap build recognizes and includes it into the build process.
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