How do Android apps implement the share button? I was wondering how Android applications and Android implements the share button and share mechanism. For instance, when I hit the share button on YouTube, a list off apps to share to pops up. How is this list determined? Is there a specific "share" intent, and then all spots capable of sharing the type of intent provided in the intent extras show up? What is the technical name of the design pattern used to implement this? Thanks.
I'm not a dev, so I just can give a raw explanation: apps declare in their Manifest which Mimetypes they understand and willing to respond to on share actions. For this they define so called "intent filters", e.g.:

&lt;intent-filter&gt;
    &lt;action android:name="android.intent.action.SEND" /&gt;
    &lt;category android:name="android.intent.category.DEFAULT"/&gt;
    &lt;data android:mimeType="application/*" /&gt;
    &lt;data android:mimeType="audio/*" /&gt;
    &lt;data android:mimeType="image/*" /&gt;
    &lt;data android:mimeType="message/*" /&gt;
    &lt;data android:mimeType="multipart/*" /&gt;
    &lt;data android:mimeType="text/*" /&gt;
    &lt;data android:mimeType="video/*" /&gt;
&lt;/intent-filter&gt;


So whenever you hit the "share" button, the content-to-share is evaluated and matched against apps having declared their willingness to receive the format.

Sources:


Intent Filter to capture all sharing Intents (StackOverflow)
Receiving Simple Data from Other Apps (developer.android.com)