I'm trying to restrict my Android app to handle only YouTube links when sharing content.
I've set up an intent filter in my AndroidManifest.xml file as follows:
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" android:host="youtu.be" android:pathPattern="/*" />
</intent-filter>
However, even after specifying the host and path pattern, my app still shows up in the share list for all types of URLs, not just YouTube links. I want my app to only appear in the share list when sharing YouTube video links.
Is there something I'm missing or any additional configuration needed to achieve this restriction? Any insights or suggestions would be greatly appreciated. Thank you!
ACTION_SEND
does not use a URL, so android:host
and android:pathPattern
will be ignored.
my app still shows up in the share list for all types of URLs, not just YouTube links
There is no option with ACTION_SEND
to filter on the content of the text being shared.
You could switch to ACTION_VIEW
, remove android:mimeType
, and add android:scheme="https"
, but that might not show up in the menus that you are seeking.