- You are using
@solana/wallet-adapter-react - The user is browsing on an Android Web environment, where MWA is usually the only available wallet.
Call connect() directly
You should explicitly handle two scenarios:
-
If MWA is already selected, you should always directly call
connect. -
If it is not selected, but available,
selectit as early as possible in your UI flow.
Example: Connect Button
Connect and Sign in a single user action
If your app uses MWA and requires a user to Sign-in-with-Solana (e.g.connect + signMessage), it needs to invoke both methods from a single user action.
Why?
IfsignMessage is invoked programmatically (e.g. in a useEffect), Android Chrome browser will block the navigation attempt in accordance with its trusted event policy.
Solution
Toconnect + signMessage in a single user action, you should directly call the signIn() method.
Mobile Wallet Adapter always supports the signIn method which invokes a connect and signMessage all within a single method.
Example: Sign In Button
Change the displayed name
Throughout your UI, use the textUse Installed Wallet as the displayed name for the MWA option.
This descriptive text helps your users understand that this option will allow them to connect to an installed mobile wallet app (via MWA).
Example: Wallet List Item Component
Code samples on this page are subject to the Apache 2.0 license.
