YouTube的意图过滤器和放大器;方案 [英] Youtube intent filter & scheme
问题描述
我试着去接收来自YouTube应用的意图。即当我preSS份额应列出上准备好接受这个意图的应用我的应用程序。但是,这些作品
Im trying to receive an intent from the Youtube App. I.e. when i press share it should list my app on the apps ready to accept this intent. But none of these works
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data
android:host="*"
android:scheme="youtube" />
<data
android:host="*"
android:scheme="vnd.youtube" />
</intent-filter>
或行动VIEW
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data
android:host="*"
android:scheme="youtube" />
<data
android:host="*"
android:scheme="vnd.youtube" />
</intent-filter>
有关如何获得意图的任何想法,以及发送一次?
谢谢
Any idea about how to get the intent as well once sent? Thanks
推荐答案
您似乎相当困惑。您正在使用的意图似乎是,像YouTube应用程序的应用程序本身将用来打开视频的意图。你想要的是分享YouTube视频,也就是一个链接,这样其他的答案提到,应声明文本/纯
意图过滤器。
You seem to be quite confused. The intents you are using seem to be the intents that an app like the YouTube app itself would use to open videos. What you want is to share a YouTube video, i.e. a link, so as the other answers mention, you should declare a text/plain
intent-filter.
不过,这种意向过滤器将捕获所有文本/纯
内容并不仅是来自YouTube上的。请参阅:意图过滤器:如何只接受&QUOT; text / plain的&QUOT;面条&QUOT;包含单词QUOT意图
However, this intent-filter will capture all text/plain
content and not only the ones that come from YouTube. See: Intent-filter: How to accept only "text/plain" intents containing the word "spaghetti"
这篇关于YouTube的意图过滤器和放大器;方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!