简体   繁体   English

未在 android 的 Metamask 应用程序上检测到以太坊提供商

[英]Not detecting ethereum provider on Metamask App for android

TL;DR A simple (typeof window.ethereum?== 'undefined'): 'META YES' : 'META NO' is saying no on android, but yes on all other platforms. TL;DR A simple (typeof window.ethereum?== 'undefined'): 'META YES' : 'META NO'在 android 上说不,但在所有其他平台上都是。

Hi all, so I have a completely stripped down react app that isn't even rendering JSX anymore because i've stripped it so far back.大家好,所以我有一个完全精简的 react 应用程序,它甚至不再渲染 JSX,因为我已经剥离了它。 Basically I have an index that looks like this:基本上我有一个看起来像这样的索引:

<!DOCTYPE html>
<html lang="en">
 <head>
 </head>
 <body>
  <div id="root"></div>
 </body>
</html>

And an index.tsx file that looks like this:还有一个如下所示的 index.tsx 文件:

const metamask = (typeof window.ethereum !== 'undefined') ? 'META YES' : 'META NO'

const doc = document.getElementById('root');

if(doc) {
  doc.innerHTML = metamask
}

Essentially, just show META YES if i have an ethereum object on the window, otherwise META NO.本质上,如果我在ethereum上有以太坊 object,则只显示 META YES,否则显示 META NO。

Now, on IOS (via the MetaMask App Browser) and on desktop (With MetaMask Extension), I get META YES.现在,在 IOS(通过 MetaMask 应用浏览器)和桌面(使用 MetaMask 扩展)上,我得到了 META YES。 But on android (via the MetaMask App Browser), I get META NO.但是在 android(通过 MetaMask 应用浏览器)上,我得到了 META NO。

And i can't think, for the life of me, why i would be getting a no, especially only on one platform.而且我想不出,就我的一生而言,为什么我会被拒绝,尤其是只在一个平台上。 Any ideas?有任何想法吗?

It's currently hosted via a HTTPS tunnel, so its running on a secure layer.它目前通过 HTTPS 隧道托管,因此它在安全层上运行。

On android, press and hold metamask icon, go to app information, memory, "force stop".在 android 上,按住 metamask 图标,go 到应用程序信息,memory,“强制停止”。 Try again.再试一次。 It worked for me after doing that, except for eth_requestAccounts method.这样做之后它对我有用,除了 eth_requestAccounts 方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM