I try only detection Web3 Browser and get account ID in Android and Desktop.
I use the examole hare.
https://docs.metamask.io/guide/mobile-best-practices.html#the-provider-window-ethereum
I don’t use the detect-provider package.
I host the HTML page with SSL(only to prevent “err_cleartext_not_permitted”) not implement any backend code. Only host.
The code work on Desktop but not on Mobile app.
In Desktop I get the message: “Ethereum successfully detected”.
In Mobile I get the message: “Please install MetaMask!”, although i enter from MetaMask browser.
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
<script type="text/javascript">
if (window.ethereum) {
handleEthereum();
} else {
window.addEventListener('ethereum#initialized', handleEthereum, {
once: true,
});
// If the event is not dispatched by the end of the timeout,
// the user probably doesn't have MetaMask installed.
setTimeout(handleEthereum, 3000); // 3 seconds
}
function handleEthereum() {
const { ethereum } = window;
if (ethereum && ethereum.isMetaMask) {
alert('Ethereum successfully detected!');
// Access the decentralized web!
} else {
alert('Please install MetaMask!');
}
}
</script>
</head>
<body>
<p>This is an example.</p>
</body>
</html>
screenshot: https://ibb.co/1vhYnt8