How to send switch network request from dapp to MetaMask Mobile


So. I build a small dapp. A user is able to connect through Metamask or Wallet-Connect.
If a user connects with MetaMask (Desktop) I use this:

if (!isClaimed[stateId]){
        method: 'wallet_switchEthereumChain',
        params: [{ chainId: chainId}]
      }).catch((err) => {
        if (err.code == 4902){
        } else {
          setError({status: null, code: err.code});


For desktop, this works.
The same request done while a user is connected through WalletConnect with their mobile Metamask, doesn’t trigger anything?
What do I need to do or change in order for sending the switch network request to the mobile wallet through WalletConnect?
Is this possible at all? (The docs don’t state it as unavailable?)

Thanks in advance!

1 Like

Hey @DeMewlingOak, welcome to the MetaMask community! :fox_face:

Try using this source code:

If you are also interested, you can join the developer community on ConsenSys Discord (MetaMask is a part of ConsenSys):

thanks first of all for the response.
I have used that approach.

And for desktop this works.
It’s just mobile metamask doesn’t get the request, or sends out the ‘chainChanged’ event when a user does it manually.

What can cause this?
Should I look into metamask, or is rather a problem with using walletConnect as the provider?

Tried searching for the issue for you, but there doesn’t seem to be any answers for it :frowning:

I would suggest try posting it in also.