Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to launch YouTube app on Android with search parameter?

I know that it is possible to launch YouTube app (if it's installed) on Android to watch a specific video. Can we do a similar thing for searching?

I mean I can use YouTube api to make a search but I don't want to do it, I just want to give search parameters to youtube app, so it can make the search for me. (So, instead of opening the web browser to show search results, I want to show the results in youtube app)

Is this possible?

like image 808
frankish Avatar asked Jul 03 '13 10:07

frankish


People also ask

How do you search YouTube on Android?

Open the YouTube app. Tap Search . Enter a search term.

How do I open YouTube settings on Android?

If you select your profile picture in the top-right corner of any YouTube page and select Settings, you'll get to the account settings page.


2 Answers

Try something like this:

 Intent intent = new Intent(Intent.ACTION_SEARCH);
 intent.setPackage("com.google.android.youtube");
 intent.putExtra("query", "something");
 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 startActivity(intent);

The "query", "something" is your search query, for example:

 intent.putExtra("query", "cats");
like image 159
Seraphim's Avatar answered Oct 06 '22 00:10

Seraphim's


You can also use a link like this: https://www.youtube.com/results?search_query=madonna

like image 28
Alex Bravo Avatar answered Oct 06 '22 01:10

Alex Bravo