Cordova/Ionic CLI hooks for modifying AndroidManifest.xml or IOS PList file?


#21

Help! I am trying to insert intent filters into AndroidManifest.xml using this hook but I am getting a syntax error.

This is what I’m trying to add to AndroidManifest.xml

<activity ...>

    <intent-filter android:autoVerify="true">
        <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" android:host="www.android.com" />
        <data android:scheme="https" android:host="www.android.com" />
    </intent-filter>

</activity>

How would I add inside the config.xml or is there another way to modify AndroidManifest.xml with a plugin?

Thank you


#22

And here is how I was adding it to the config.xml

    <platform name="android">
    <config-file target="AndroidManifest.xml" parent="./application/activity/[@android:name='MainActivity']">
    <intent-filter android:autoVerify="true">
        <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" android:host="www.android.com" />
        <data android:scheme="https" android:host="www.android.com" />
    </intent-filter>	
    </config-file>
	       <config-file target="AndroidManifest.xml" parent="./" mode="add">
            <application android:name="customApplication"></application>
        </config-file>
    </platform>