user9708219
user9708219

Reputation:

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

Upvotes: 3

Views: 2145

Answers (1)

user9708219
user9708219

Reputation:

I found our by testing different things that If you have discord installed you don't explicitly need to specify anything, I did it as follows

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

Upvotes: 3

Related Questions