Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android youtube: share a youtube video TO my app?

Tags:

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.

like image 318
Carsten Drösser Avatar asked Jun 24 '12 13:06

Carsten Drösser


People also ask

Can I share YouTube videos on my app?

Go to the video you'd like to share. Under the video player, tap Share. . Select Copy link, or select an app to share the link directly via that app.


1 Answers

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!

like image 185
Ditraoult Gilbert Olivier Avatar answered Oct 03 '22 04:10

Ditraoult Gilbert Olivier