简体   繁体   中英

how can i open discord server invite with intent based URI?

I want an intent to open discord server in android.

I know how to do it for twitter, tried like this but does not work

try {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("twitter://user?screen_name=username")));
} catch (Exception e) {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/username")));
}

我通过测试不同的东西找到了我们,发现如果您安装了不和谐的东西,则不需要明确指定任何内容,我按如下方式进行

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://discord.gg/invitecode")))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM