Questioner
Questioner

Reputation: 7463

How do I make a valid config.xml for my Phonegap project?

I am trying to include the WebIntent plugin for my Phonegap Android app. In the documentation for installing it, it says one needs to add a line to the res/xml/config.xml file. However, I have no config.xml file.

I did a little searching, and it seems that people say it's okay to simply create a config.xml, so I did, using some guidelines from examples I came across. However, the Android Developer Tools interface is showing red Xs and red squiggly error lines all over it, indicating that it's full of mistakes. Here's what it looks like:

invalid config.xml

What should my config.xml file look like?

Or, alternatively, if there's a better tutorial or method for including the WebIntent plugin, please let me know.

Upvotes: 2

Views: 11702

Answers (2)

digiwand
digiwand

Reputation: 1348

My solution upon the initial creation of the project:

Instead of creating the project through the PhoneGap Desktop App, I built the project using PhoneGap cli by typing in:

phonegap create "projectName"

This created the project with config.xml successfully. Now you can open the created file using the PhoneGap Desktop App.

Reference: http://phonegap.com/blog/2014/11/13/phonegap-cli-3-6-3/

Upvotes: 0

Henry Blackman
Henry Blackman

Reputation: 165

Your config.xml should look like this in Phonegap 2.7 or above. Older versions don't use the feature tags. This is the out of the box config and has everything in it.

<?xml version="1.0" encoding="UTF-8"?>

<widget xmlns     = "http://www.w3.org/ns/widgets"
    id        = "io.cordova.helloCordova"
    version   = "2.0.0">
<name>APP NAME</name>

<description>
    DESCRIPTION
</description>

<author href="YOUR URL" email="YOUR EMAIL">
    YOUR NAME
</author>

<access origin="*"/>

<!-- <content src="http://mysite.com/myapp.html" /> for external pages -->
<content src="index.html" />

<preference name="loglevel" value="DEBUG" />
<!--
  <preference name="splashscreen" value="resourceName" />
  <preference name="backgroundColor" value="0xFFF" />
  <preference name="loadUrlTimeoutValue" value="20000" />
  <preference name="InAppBrowserStorageEnabled" value="true" />
  <preference name="disallowOverscroll" value="true" />
-->

<feature name="App">
  <param name="android-package" value="org.apache.cordova.App"/>
</feature>
<feature name="Geolocation">
  <param name="android-package" value="org.apache.cordova.GeoBroker"/>
</feature>
<feature name="Device">
  <param name="android-package" value="org.apache.cordova.Device"/>
</feature>
<feature name="Accelerometer">
  <param name="android-package" value="org.apache.cordova.AccelListener"/>
</feature>
<feature name="Compass">
  <param name="android-package" value="org.apache.cordova.CompassListener"/>
</feature>
<feature name="Media">
  <param name="android-package" value="org.apache.cordova.AudioHandler"/>
</feature>
<feature name="Camera">
  <param name="android-package" value="org.apache.cordova.CameraLauncher"/>
</feature>
<feature name="Contacts">
  <param name="android-package" value="org.apache.cordova.ContactManager"/>
</feature>
<feature name="File">
  <param name="android-package" value="org.apache.cordova.FileUtils"/>
</feature>
<feature name="NetworkStatus">
  <param name="android-package" value="org.apache.cordova.NetworkManager"/>
</feature>
<feature name="Notification">
  <param name="android-package" value="org.apache.cordova.Notification"/>
</feature>
<feature name="Storage">
  <param name="android-package" value="org.apache.cordova.Storage"/>
</feature>
<feature name="FileTransfer">
  <param name="android-package" value="org.apache.cordova.FileTransfer"/>
</feature>
<feature name="Capture">
  <param name="android-package" value="org.apache.cordova.Capture"/>
</feature>
<feature name="Battery">
  <param name="android-package" value="org.apache.cordova.BatteryListener"/>
</feature>
<feature name="SplashScreen">
  <param name="android-package" value="org.apache.cordova.SplashScreen"/>
</feature>
<feature name="Echo">
  <param name="android-package" value="org.apache.cordova.Echo"/>
</feature>
<feature name="Globalization">
  <param name="android-package" value="org.apache.cordova.Globalization"/>
</feature>
<feature name="InAppBrowser">
  <param name="android-package" value="org.apache.cordova.InAppBrowser"/>
</feature>
<!-- Deprecated plugins element. Remove in 3.0 -->
<plugins>
<plugin name="WebIntent" value="com.borismus.webintent.WebIntent" />
</plugins>
</widget>

Upvotes: 3

Related Questions