Is it possible to run the YouTube app on Android with a search option?

I know that you can run the YouTube app (if installed) on Android to watch a specific video. Can we do a similar thing to search?

I mean, I can use the YouTube api to search, but I do not want to do this, I just want to specify the search parameters for the youtube application so that it can perform a search for me. (So, instead of opening a web browser to display the search results, I want to show the results in the YouTube app)

Is it possible?

+4
source share
1 answer

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

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

  intent.putExtra("query", "cats"); 
+5
source

Source: https://habr.com/ru/post/1489459/


All Articles