title: Web battery API working very slow on Android
body: <p>I have made a battery level monitor using web programming languages. Here is my code :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>if('getBattery' in navigator)
    {
     navigator.getBattery().then(function get(battery)
     {
      var l=Math.round(battery.level*100);
      var d=document. getElementById('level'), lab=document. getElementById ('label');
      d. style. height=l+"%";
      lab.innerHTML=l+" %";
      if(l&gt;=50)
      {
       d. style. backgroundColor="#00ff00";
       lab. style. color="#000";
      }
      else if(l&gt;=20)
       d. style. backgroundColor="#0000ff";
      else
       d. style. backgroundColor="#ff0000";
     });
    }
    else
     alert("Battery API not supported on your browser !");</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>html, body {width: 100%; height: 100%; margin: 0; padding:0;}
     body {background-color: black;}
     #level {position: absolute; text-align: center; left: 0; right: 0; margin: 5mm;}
     #label {font-size: 1cm; left: 0; right: 0; text-align: center; color:#fff; top: 50%; position: absolute; transform: translateY (-50%);}</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
   &lt;head&gt;
    &lt;title&gt;Battery level&lt;/title&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
   &lt;/head&gt;
   &lt;body&gt;
    &lt;div id="level"&gt;
     &lt;label id="label"&gt;&lt;/label&gt;
    &lt;/div&gt;
   &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>What I noticed is that, in the Android version of Chrome, the output of this program is very very slow. It takes about 10 seconds in my Android phone to display the battery level. Whereas, in the desktop version of Chrome, the battery level is displayed within a fraction of second.  </p>
  
  <p>I had also tried this <a href="https://pazguille.github.io/demo-battery-api/" rel="nofollow noreferrer">Battery status API demo</a>, but still the same problem.<br>
  Previously, in earlier versions of Chrome, it used to work fine, but since I upgraded to the latest version (77), this problem is occurring. When I uninstalled the updates and downgraded Chrome to the factory version and again tried to run the program, it worked fine, but on reinstalling the latest version, the problem is still there.</p>
  
  <p>What could be the probable cause for this slowdown and how to fix this? Am I missing some important settings in the latest version of Google Chrome? <em>Please help</em>.</p>