意图打开 Twitch 用户个人资料

Intent to open a Twitch user profile

我想要打开用户的 twitch 个人资料的意图,但我不知道在 Uri.parse(?) 中输入什么,我试过了但没有用 Intent to open Instagram user profile on Android

public String username;

public Intent TwitchProfile(){
    Intent i;

    try {
        i = new Intent(Intent.ACTION_VIEW, Uri.parse("<what should I put here>://user?screen_name=" + username));
    }catch (Exception e) {
       i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.twitch.com/" + username));
    }
    return i;
}

试试这个:

Uri uri = Uri.parse("https://www.twitch.com/_u/" + username);

Intent likeIng = new Intent(Intent.ACTION_VIEW, uri);

likeIng.setPackage("tv.twitch.android.viewer");

try {
    startActivity(likeIng);
} catch (ActivityNotFoundException e) {
    startActivity(new Intent(Intent.ACTION_VIEW,
            Uri.parse("https://www.twitch.com/"  + username)));
}

更多详情,您可以访问:https://dev.twitch.tv/docs/mobile-deeplinks/#launching-the-twitch-app