I am developing a phonegap and would like to use intents for android. When I add the following to AndroidManifest.xml (within platforms/android) it works like expected.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="*mysite.com" />
<data android:host="*mysite.de" />
</intent-filter>
Now I would like to know how to configure this not via AndroidManifest.xml but via config.xml under www/ since as far as i understand the AndroidManifest.xml file might be overwritten during the build process and the config.xml is the right place for stuff like this. I tried the following (including all kinds of variations):
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest/application/activity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="*mysite.de" />
<data android:host="*mysite.com" />
</intent-filter>
</config-file>
</platform>
...unfortunately this will always result in the following error:
[echo] ----------
[echo] Handling Resources...
[aapt] Found modified input file
[aapt] Generating resource IDs...
[aapt] /home/.../platforms/android/res/xml/config.xml:30: error: Error parsing XML: unbound prefix
Any idea is appreciated, I searched the web for over an hour.
My phonegap version is 3.5.0-0.21.18
With older versions of cordova 3, androidmanifest.xml updates were kept. I started to have surprises with version 3.5 when they added more options with the preference tag.
For example, I used to configure AndroidLaunchMode by updating AndroidManifest.xml and now they added an option to allow this configuration in config.xml which made that after upgrading cordova cli, my setting disapeared untill I realised what was going on.
For the moment,
cordova prepare android
will not delete your intent filter, so that means that with current build of cordova you will loose your changes only if you remove the android platform or you upgrade to a newer cordova android which would allow such configuration.If you want to be sure not to loose this setting, you may write a hook in post-prepare to update AndroidManifest.xml.
Or you could make a plugin that would only update AndroidManifest.xml (the config-file syntax you're trying to use seems to be more plugin.xml syntax).