MeCe
MeCe

Reputation: 465

Intents for Specific Web Sites - Android

I would like my app receive intents if a specific link is shared from other apps. For example, the link is youtube. There are a couple links for youtube.

www.youtube.com/...

m.youtube.com/...

youtu.be/...

If any of these links are shared, either from youtube app, or chrome or some other app, I want my app to be on the share list. Otherwise I don't want it to be shown at the share list. I think I've seen some apps do this but I'm not sure how.

I added these codes to manifest file but on chrome every link can be shared to my app.

<intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:host="www.youtube.com" android:mimeType="text/*" />
</intent-filter>
<intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:host="m.youtube.com" android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:host="youtu.be"
          android:mimeType="text/plain" />
</intent-filter>

I can handle the link with the code in the activity file, but I'm looking for another way to limit the links with the ones I specifically give.

I'm a newbee on Android so forgive me if this question sounds a little bit off.

Thank you,

Upvotes: 0

Views: 31

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007339

What you want is not possible. You cannot filter on a value in an extra (e.g., EXTRA_TEXT or EXTRA_STREAM).

Upvotes: 1

Related Questions