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!


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.

1 Like

Hi, I’m facing the same issue for mobile too.

I called the wallet_switchEthereumChain as well and all it did is redirects me to Metamask and back without doing anything.

Is there any fix or workaround for this already? Can’t seem to search this anywhere in ethereum stackexchange also.


Hello @YYee

have you found any solution to this?


I am facing the same problem. I don´t know how to switch the network via MetaMask mobile.

Hello @robsonsf ! Welcome to MetaMask community!

Can you provide your code with more verbose error output?
here or create a new topic on the forum


I don´t have an error. I just want to know how to switch the network in MetaMask mobile using code.

1 Like

I got it. I already wrote about it in the next topic.
Let me know if something didn’t work out for you :wink: