[
https://issues.apache.org/jira/browse/CB-8955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14546861#comment-14546861
]
jcesarmobile commented on CB-8955:
----------------------------------
Maybe it should return the battery current status the first time
The battery plugin seems to follow an old W3C API recommendation:
http://www.w3.org/TR/2011/WD-battery-status-20110915/
Maybe the plugin should be updated to use the latest recommendation
http://www.w3.org/TR/2014/CR-battery-status-20141209/
It has a navigator.getBattery() method that provides the level on the first
call and you can set a listener for levelchange
navigator.getBattery().then(function(battery) {
console.log(battery.level);
battery.addEventListener('levelchange', function() {
console.log(this.level);
});
});
> iOS - Current Battery Status
> ----------------------------
>
> Key: CB-8955
> URL: https://issues.apache.org/jira/browse/CB-8955
> Project: Apache Cordova
> Issue Type: Improvement
> Components: Plugin Battery Status
> Environment: iOS
> Reporter: Matthew Keable
> Priority: Minor
>
> My understanding of the current Battery Status plugin on iOS is that we can
> only receive data via the battery status listeners. However, these only fire
> when the device is (un)plugged or the battery percentage changes by 1%.
> There doesn't seem to be a method that enables you to get the current status.
> For instance I have an app that I'd like to be able to show the current
> battery status on screen, but on launch those values remain empty until the
> first time this listener fires.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]