It is the wish of every smartphone user if it could come true but unfortunatly this doesn't represent reality. Meanwhile... I'm getting that the battery.dischargingTime
of my android phone is Inifinite...! (and I wish it was, but it isn't)
This is my code:
if(navigator.getBattery){
var battery = navigator.getBattery().then(function(battery){
var level = battery.level;
var rest = battery.dischargingTime;
});
}
After that, level is 0.94, this is correct, but rest is Infinite. I could understand it didn't work for my desktop computer but on mobile...! I'm using an android with Chrome 43 btw.
EDIT: I also noticed that in chrome for iPhone this is not even passing the test for the support, despite caniuse not mentioning it: http://caniuse.com/#search=battery
It basically says "sorry, dunno". Ignore that value as invalid and check back again later.