YouTube have a great way of indicating time in their URL for the videos.
The Intent
will look something like startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=Z149x12sXs" + time)));
where String time = "&t=0m30s";
Edit: Expansion for YouTube App.
public static void watchYoutubeVideo(String id, String time){
Intent appIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + id + time));
Intent webIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("https://www.youtube.com/watch?v=" + id + time));
try {
startActivity(appIntent);
} catch (ActivityNotFoundException ex) {
startActivity(webIntent);
}
}
Using another answer from that question. The same logic can be applied to any intent just add the Time
string to the URI
like shown above regardless of intention.