机器人的YouTube:共享YouTube视频到我的应用程序?我的、机器人、应用程序、视频

2023-09-04 11:24:45 作者:放纵你

在为平板电脑内置的YouTube应用程序有一个共享的选项。例如:我在观看YouTube应用程序的视频,然后单击按钮为共享。蓝牙,G​​ooglemail电子邮件,和Dropbox出现我。 我不知道我怎么能列出我的应用程序有?其中意向滤波器我的应用程序有哪些?如何我获得视频网址呢? 任何想法? 谢谢你。

The built in YouTube App for tablets has a sharing-option. For example: I watch a video in the YouTube app and click the button to share. Bluetooth, Googlemail, and Dropbox appear for me. I wonder how i can list my app there? Which intent-filter has my app to have? How do i get the video url then? Any idea? Thanks.

推荐答案

这为我工作。 加入这个意图过滤器到您的清单文件,使您的应用程序出现在YouTube的应用程序的份额列表中显示。

This worked for me. Add this intent filter to your manifest file to make your application appear in the share list of the youtube application.

<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>

然后检索它在你的活动,用这个:

Then to retrieve it in your activity, use this :

Bundle extras = getIntent().getExtras();
 String value1 = extras.getString(Intent.EXTRA_TEXT);

在这里,您们!

Here you are!