Device.getInfo can take up to 1 min on web platform on Chrome 76 on Android
See original GitHub issueDescription 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:
- Split the
getInfo
in 2 methods :getInfo
andgetBattery
. - Add a
withBattery
parameter to the getInfo to have to battery info. - 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:
- Created 4 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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(); }; }
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.