Skip to content

Conversation

@kennylevinsen
Copy link
Contributor

Intent filters can match on the data of an intent through the tag. When multiple tags are present, they act as a boolean OR, intended if you want to match multiple data types. When a boolean AND is required, the attributes should instead be added to a single tag.

Two of our intent filters try to match ".pbw" and ".pbz" files. These both start with a single match on the "content" schema, followed by a match on the "/" MIME type, and finally a path filter for the file type in question. By virtue of being boolean OR, this meant that both filters would match every possible URL.

Combine the attributes in a single data tag to turn it into a boolean AND for both of these filters.

Intent filters can match on the data of an intent through the <data>
tag. When multiple tags are present, they act as a boolean OR, intended
if you want to match multiple data types. When a boolean AND is
required, the attributes should instead be added to a single <data> tag.

Two of our intent filters try to match ".pbw" and ".pbz" files. These
both start with a single match on the "content" schema, followed by a
match on the "*/*" MIME type, and finally a path filter for the file
type in question. By virtue of being boolean OR, this meant that both
filters would match every possible URL.

Combine the attributes in a single data tag to turn it into a boolean
AND for both of these filters.
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="content" />
<data android:mimeType="*/*" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know about pbz, but pbw is a zip archive, so you can use that mime type for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants