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_SENDdoes not use a URL, soandroid:hostandandroid:pathPatternwill be ignored.There is no option with
ACTION_SENDto filter on the content of the text being shared.You could switch to
ACTION_VIEW, removeandroid:mimeType, and addandroid:scheme="https", but that might not show up in the menus that you are seeking.