title: How to add app-links on a Meteor-cordova project
body: <p>I have a Meteor 1.8.1 which uses Cordova 7.1.4 for Android build. 
  I want to add app-links so that when a user clicks on a <code>myApp.com</code> link the app is open instead of the browser.</p>
  
  <p>I have added the following to mobile-config.js:</p>
  
  <pre><code>App.appendToConfig(`
  
  &lt;platform name="android"&gt;
    &lt;config-file target="app/src/main/AndroidManifest.xml" parent="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;activity android:name="MainActivity" android:label="@string/title_myApp" &gt;
          &lt;intent-filter android:label="@string/filter_view_http_myApp"&gt;
            &lt;action android:name="android.intent.action.VIEW" /&gt;
            &lt;category android:name="android.intent.category.DEFAULT" /&gt;
            &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
            &lt;data android:scheme="https" android:host="www.myApp.com" android:pathPrefix="/" /&gt;
            &lt;data android:scheme="https" android:host="myApp.com" android:pathPrefix="/" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
    &lt;/config-file&gt;
  &lt;/platform&gt;
  `)
  </code></pre>
  
  <p>When I try to compile the APK I get the following error:</p>
  
  <pre><code>BUILD FAILED in 1s
  27 actionable tasks: 4 executed, 23 up-to-date
  =&gt; Errors executing Cordova commands:         
  
     While building Cordova app for platform Android:
     Error: /home/meteor/myApp/app/.meteor/local/cordova-build/platforms/android/gradlew: Command failed with exit code 1 Error output:
     /home/meteor/myApp/app/.meteor/local/cordova-build/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:100: AAPT: error: unexpected element &lt;intent-filter&gt;
     found in &lt;manifest&gt;&lt;application&gt;.
  
     /home/meteor/myApp/app/.meteor/local/cordova-build/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:111: AAPT: error: unexpected element &lt;intent-filter&gt;
     found in &lt;manifest&gt;&lt;application&gt;.
  
     /home/meteor/myApp/app/.meteor/local/cordova-build/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:130: AAPT: error: unexpected element &lt;receiver&gt; found
     in &lt;manifest&gt;&lt;application&gt;&lt;activity&gt;.
  
     /home/meteor/myApp/app/.meteor/local/cordova-build/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:100: error: unexpected element &lt;intent-filter&gt; found
     in &lt;manifest&gt;&lt;application&gt;.
     /home/meteor/myApp/app/.meteor/local/cordova-build/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:111: error: unexpected element &lt;intent-filter&gt; found
     in &lt;manifest&gt;&lt;application&gt;.
     /home/meteor/myApp/app/.meteor/local/cordova-build/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:130: error: unexpected element &lt;receiver&gt; found in
     &lt;manifest&gt;&lt;application&gt;&lt;activity&gt;.
  </code></pre>
  
  <p>Generated <code>/home/meteor/myApp/app/.meteor/local/cordova-build/platforms/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml</code> looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.myApp.app"
      android:hardwareAccelerated="true"
      android:versionCode="10003"
      android:versionName="1.0.3" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="19"
          android:targetSdkVersion="28" /&gt;
  
      &lt;supports-screens
          android:anyDensity="true"
          android:largeScreens="true"
          android:normalScreens="true"
          android:resizeable="true"
          android:smallScreens="true"
          android:xlargeScreens="true" /&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission
          android:name="android.permission.BLUETOOTH"
          android:maxSdkVersion="18" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
      &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
      &lt;!-- for android --&gt;
      &lt;!-- &lt;uses-permission android:name="com.android.launcher.permission.READ_SETTINGS"/&gt; --&gt;
      &lt;!-- &lt;uses-permission android:name="com.android.launcher.permission.WRITE_SETTINGS"/&gt; --&gt;
      &lt;!-- &lt;uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /&gt; --&gt;
      &lt;!-- &lt;uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" /&gt; --&gt;
      &lt;!-- for Samsung --&gt;
      &lt;uses-permission android:name="com.sec.android.provider.badge.permission.READ" /&gt;
      &lt;uses-permission android:name="com.sec.android.provider.badge.permission.WRITE" /&gt; &lt;!-- for htc --&gt;
      &lt;uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS" /&gt;
      &lt;uses-permission android:name="com.htc.launcher.permission.UPDATE_SHORTCUT" /&gt; &lt;!-- for sony --&gt;
      &lt;uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE" /&gt;
      &lt;uses-permission android:name="com.sonymobile.home.permission.PROVIDER_INSERT_BADGE" /&gt; &lt;!-- for apex --&gt;
      &lt;uses-permission android:name="com.anddoes.launcher.permission.UPDATE_COUNT" /&gt; &lt;!-- for solid --&gt;
      &lt;uses-permission android:name="com.majeur.launcher.permission.UPDATE_BADGE" /&gt; &lt;!-- for huawei --&gt;
      &lt;uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" /&gt;
      &lt;uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" /&gt;
      &lt;uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" /&gt; &lt;!-- for ZUK --&gt;
      &lt;uses-permission android:name="android.permission.READ_APP_BADGE" /&gt; &lt;!-- for OPPO --&gt;
      &lt;uses-permission android:name="com.oppo.launcher.permission.READ_SETTINGS" /&gt;
      &lt;uses-permission android:name="com.oppo.launcher.permission.WRITE_SETTINGS" /&gt; &lt;!-- for EvMe --&gt;
      &lt;uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_READ" /&gt;
      &lt;uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_WRITE" /&gt; &lt;!-- Required by older versions of Google Play services to create IID tokens --&gt;
      &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;
  
      &lt;permission
          android:name="com.myApp.app.permission.C2D_MESSAGE"
          android:protectionLevel="signature" /&gt;
  
      &lt;uses-permission android:name="com.myApp.app.permission.C2D_MESSAGE" /&gt;
  
      &lt;application
          android:name="android.support.multidex.MultiDexApplication"
          android:debuggable="true"
          android:hardwareAccelerated="true"
          android:icon="@mipmap/icon"
          android:label="@string/app_name"
          android:supportsRtl="true" &gt;
          &lt;activity
              android:name="com.myApp.app.MainActivity"
              android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
              android:label="@string/activity_name"
              android:launchMode="singleTop"
              android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
              android:windowSoftInputMode="adjustResize" &gt;
              &lt;intent-filter android:label="@string/launcher_name" &gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name="com.adobe.phonegap.push.PushHandlerActivity"
              android:exported="true"
              android:permission="com.myApp.app.permission.PushHandlerActivity" /&gt;
  
          &lt;receiver android:name="com.adobe.phonegap.push.BackgroundActionButtonHandler" /&gt;
          &lt;receiver android:name="com.adobe.phonegap.push.PushDismissedHandler" /&gt;
  
          &lt;service android:name="com.adobe.phonegap.push.FCMService" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.firebase.MESSAGING_EVENT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
          &lt;service android:name="com.adobe.phonegap.push.PushInstanceIDListenerService" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.firebase.INSTANCE_ID_EVENT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  
          &lt;receiver
              android:name="com.appsflyer.MultipleInstallBroadcastReceiver"
              android:exported="true" /&gt;
  
          &lt;intent-filter android:label="@string/filter_view_http_myApp" &gt;
              &lt;action android:name="android.intent.action.VIEW" /&gt;
  
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
  
              &lt;data
                  android:host="www.myApp.com"
                  android:pathPrefix="/"
                  android:scheme="https" /&gt;
          &lt;/intent-filter&gt;
          &lt;intent-filter android:label="@string/filter_view_http_myApp" &gt;
              &lt;action android:name="android.intent.action.VIEW" /&gt;
  
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
  
              &lt;data
                  android:host="www.myApp.com"
                  android:pathPrefix="/"
                  android:scheme="https" /&gt;
              &lt;data
                  android:host="myApp.com"
                  android:pathPrefix="/"
                  android:scheme="https" /&gt;
          &lt;/intent-filter&gt;
  
          &lt;activity
              android:name="com.myApp.app.ShareActivity"
              android:label="@string/title_myApp" &gt;
              &lt;receiver
                  android:name="com.appsflyer.MultipleInstallBroadcastReceiver"
                  android:exported="true" /&gt;
  
              &lt;intent-filter android:label="@string/filter_view_http_myApp" &gt;
                  &lt;action android:name="android.intent.action.VIEW" /&gt;
  
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
                  &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
  
                  &lt;data
                      android:host="www.myApp.com"
                      android:pathPrefix="/"
                      android:scheme="https" /&gt;
                  &lt;data
                      android:host="myApp.com"
                      android:pathPrefix="/"
                      android:scheme="https" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;!--
           FirebaseMessagingService performs security checks at runtime,
               no need for explicit permissions despite exported="true"
          --&gt;
          &lt;service
              android:name="com.google.firebase.messaging.FirebaseMessagingService"
              android:exported="true" &gt;
              &lt;intent-filter android:priority="-500" &gt;
                  &lt;action android:name="com.google.firebase.MESSAGING_EVENT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  
          &lt;receiver
              android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
              android:enabled="true"
              android:exported="false" &gt;
          &lt;/receiver&gt;
          &lt;receiver
              android:name="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver"
              android:enabled="true"
              android:exported="true"
              android:permission="android.permission.INSTALL_PACKAGES" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.android.vending.INSTALL_REFERRER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
  
          &lt;service
              android:name="com.google.android.gms.measurement.AppMeasurementService"
              android:enabled="true"
              android:exported="false" /&gt;
          &lt;service
              android:name="com.google.android.gms.measurement.AppMeasurementJobService"
              android:enabled="true"
              android:exported="false"
              android:permission="android.permission.BIND_JOB_SERVICE" /&gt;
  
          &lt;receiver
              android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
              android:exported="true"
              android:permission="com.google.android.c2dm.permission.SEND" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt;
  
                  &lt;category android:name="com.myApp.app" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
          &lt;!--
   FirebaseInstanceIdService performs security checks at runtime,
               no need for explicit permissions despite exported="true"
          --&gt;
          &lt;service
              android:name="com.google.firebase.iid.FirebaseInstanceIdService"
              android:exported="true" &gt;
              &lt;intent-filter android:priority="-500" &gt;
                  &lt;action android:name="com.google.firebase.INSTANCE_ID_EVENT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  
          &lt;provider
              android:name="com.google.firebase.provider.FirebaseInitProvider"
              android:authorities="com.myApp.app.firebaseinitprovider"
              android:exported="false"
              android:initOrder="100" /&gt;
  
          &lt;meta-data
              android:name="com.google.android.gms.version"
              android:value="@integer/google_play_services_version" /&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>