WalletConnect / kotlin-walletconnect-lib

library to use WalletConnect with Kotlin or Java
MIT License
147 stars 100 forks source link

How can I open metamask and trust wallet app directly? #59

Open hungMta opened 2 years ago

hungMta commented 2 years ago

I see in the example using "wc:" schema to open wallet app and I have to choose which app I want to open in a dialog. But I want to open the app directly so how can I do that? There are any schemas to open Metmask or Trust wallet directly?

I appreciate your help.

nghiatesuji commented 2 years ago

Try this:

val intent = context?.packageManager?.getLaunchIntentForPackage("io.metamask")
intent?.action = Intent.ACTION_VIEW
intent?.data = Uri.parse(config.toWCUri())
startActivity(intent)
wangtingshun commented 2 years ago

val intent = context?.packageManager?.getLaunchIntentForPackage("io.metamask") intent?.action = Intent.ACTION_VIEW intent?.data = Uri.parse(config.toWCUri()) startActivity(intent)

report an error:

image
wangtingshun commented 2 years ago

Try this: intent = Intent(Intent.ACTION_VIEW) intent?.setPackage("io.metamask") intent?.data = Uri.parse(config.toWCUri()) startActivity(intent)