question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Device.getInfo can take up to 1 min on web platform on Chrome 76 on Android

See original GitHub issue

Description of the problem: I opened this issue on chromium : https://bugs.chromium.org/p/chromium/issues/detail?id=999063 In Chrome 76 on Android, the navigator.getBattery promise can take up to 1 min if the phone is not charging (if you plug your phone, the promise resolve immediately). Code example : https://codesandbox.io/embed/android-chrome-76-battery-issue-mhvdn

The getInfo method on the Device web plugin wait for the battery. I see some solutions:

  1. Split the getInfo in 2 methods : getInfo and getBattery.
  2. Add a withBattery parameter to the getInfo to have to battery info.
  3. Add a timeout on the getInfo method

I prefer the first solution but it’s a breaking change. What’s your opinion about this ?

Affected platform

  • Android
  • iOS
  • electron
  • web

OS of the development machine

  • Windows
  • macOS
  • linux

Other information: The bug is only on Chrome 76 on Android when phone is not charging 😳

Capacitor version: all node version: all npm version: all

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jurepurgarcommented, Aug 30, 2019

If you don’t actually need the battery status the temporary solution could be to just override the function, before it is called, like this: if (navigator.getBattery) { navigator.getBattery = function () { return Promise.reject(); }; }

0reactions
ionitron-bot[bot]commented, Nov 13, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Manage Chrome safety and security - Android - Google Support
On your Android phone or tablet, open the Chrome app Chrome . Tap More Organize and then Settings. Tap Safety Check and then...
Read more >
Google Chrome: Fast & Secure - Apps on Google Play
Google Chrome is a fast, easy to use, and secure web browser. Designed for Android, Chrome brings you personalized news articles, quick links...
Read more >
google drive hunger games
Google Drive Hunger GamesShowcase and Showcase Cinema de Lux are committed to providing you with the ultimate film-going experience.
Read more >
Turn on and off dark mode on Chrome - WiseStamp
Set dark mode on google chrome on a desktop or mobile and select dark theme or night mode on PC (Windows 10), Android,...
Read more >
I Come To The Garden Alone Youtube - p2w1.com is for sale
There are a lot of great things you can do for your garden in the fall ... is still on the roses Find...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found