gap:config-file for adding additional intent-filter

  • 2
  • Question
  • Updated 4 years ago
  • Answered
Hello,

After reading the Config File Elements documentation and a-lot of trial and error I was able to get this to mostly work, i.e. tapping a link to the "android:host" shows the Android chooser with my app as an option along with Chrome.

The trick was to create an activity-alias containing the intent-filter instead of trying to craft an xpath for "parent" that injected it into the default activity.

This is a hack and has issues and I would much prefer a method that allowed me to add a second intent-filter to the default activity.

Is this possible? I am by no means an Android or xpath expert but the merging of the XML never resulted in the output I was after. I don't know what xpath to supply for parent that says: 'In the first activity and AFTER the existing intent-filter closing tag add another intent-filter'.

For example if the following were legal XML it would do what I want:

</intent-filter>
<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:host="my.appdomain.com" android:scheme="http" />


because once PGB merged it the result would then be:

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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:host="my.appdomain.com" android:scheme="http" />
</intent-filter>


Which is what I am after.

Can this be achieved with the current PGB (3.6.3)?
Photo of cce32

cce32

  • 4 Posts
  • 1 Reply Like

Posted 6 years ago

  • 2
Photo of Amir

Amir

  • 8261 Posts
  • 263 Reply Likes
Hi

You can try any combination to get into final result so it will be merged with the default manifest xml, and when conflicts
occur, your specified values will take precedence. To check and debug
the resulting Android Manifest, you can use the Android apk-tool to unpack your compiled apk, and examine the AndroidManifest.xml.

http://docs.build.phonegap.com/en_US/configuring_config_file_element.md.html#Config%20File%20Element...

Thanks
Photo of cce32

cce32

  • 4 Posts
  • 1 Reply Like
Hi Amir, unfortunately your answer only reiterated information in my question... is it possible to add a second intent-filter using the config file elements feature?
Photo of cce32

cce32

  • 4 Posts
  • 1 Reply Like
Let me rephrase my question.

How can I add a second intent-filter using your Config File Elements feature?

Regards
Photo of persyval

persyval

  • 3 Posts
  • 0 Reply Likes
Anyone ever found out how to do this?
Seems to be a showstopper to use the phonegap build service and need to go back to my own builds then.
Photo of Daniel Boom

Daniel Boom

  • 2 Posts
  • 0 Reply Likes
any news on this?