How do I display my app on YouTube sharing?

Asked 1 years ago, Updated 1 years ago, 111 views

I'm thinking of getting a video URL from sharing YouTube videos and handing it over to my own app.
What are the possible ways to display your own apps on the shared screen?

android iphone

2022-09-30 21:19

2 Answers

For Android apps, if you set AndroidManifest.xml as an int-filter, the app will be displayed in Share... of each video of the Android app on YouTube.

<intent-filter>
    <action android:name="android.intent.action.SEND"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:mimeType="text/*"/>
</intent-filter>

See also


2022-09-30 21:19

AndroidManifest.xml is

<activity>
    <intent-filter>
       <action android:name="android.intent.action.SEND"/>
       <category android:name="android.intent.category.DEFAULT"/>
       <data android:mimeType="text/*"/>
    </intent-filter>
    </activity>

Receive Activity (e.g. MainActivity) onCreate

Intent=getIntent();
    String action=intent.getAction();
    if(Intent.ACTION_SEND.equals(action)){
      Bundleextras=intent.getExtras();
      if(extras!=null){
      CharSequence ext=extras.getCharSequence(Intent.EXTRA_TEXT);
        if(ext!=null){
         EditTexteditText= (EditText) findbyid (R.id.***); // Example
          editText.setText(ext); // Example
          }
        }
    }

Reference site


2022-09-30 21:19

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.