frankish
frankish

Reputation: 6826

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?

Upvotes: 6

Views: 2502

Answers (2)

Alex Bravo
Alex Bravo

Reputation: 1598

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

Upvotes: 1

Seraphim's
Seraphim's

Reputation: 12768

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");

Upvotes: 5

Related Questions