Skip to content

Alignment with W3C Battery API#24

Open
pContat wants to merge 9 commits into
apache:masterfrom
pContat:CB-6065cordova-plugin-battery-status
Open

Alignment with W3C Battery API#24
pContat wants to merge 9 commits into
apache:masterfrom
pContat:CB-6065cordova-plugin-battery-status

Conversation

@pContat

@pContat pContat commented Jun 24, 2015

Copy link
Copy Markdown

Addition of the methode navigator.getBattery which return a BatteryManager object using promises to align with the W3C API

Here is the associate Jira issue.

Some notes on the proposed changes:

  • The previous navigator.battery and the new navigator.getBattery can't run together on android ( only one callbackContext allowed with the current version)
  • chargingtime and dischargingtime value aren't available for now (since that data is not provided by default at least on Android and FirefoxOS)

Also, I was not clear whether there is a coding guideline (formatting, etc) ? I tried to keep it close to the original

pContat added 9 commits June 22, 2015 11:08
- CB-7583 : readonly property called charging
- CB-7589 : readonly property called level
- CB-7585 : readonly property called chargingTime
- CB-7587 : readonly property called dischargingTime
- CB-7581 : The W3C battery status specification uses promises.
- CB-7581 : Battery information should be accessible from navigator.getBattery()
- CB-7584 : event handler: onchargingchange
@sarangan12

Copy link
Copy Markdown

Let there be tests

@cordova-qa

Copy link
Copy Markdown

Cordova CI Build has one or more failures.

Commit - Link
Dashboard - Link

Builder Name Console Output Test Report Device Logs
Windows 8.1 Store Link Link Link
Windows 10 Store Link Link Link
Windows 8.1 Phone Link Link Link
iOS Link Link Link
Android Mac Link Link Link

@halindrome

Copy link
Copy Markdown

Is there some way we can rejuvenate this PR? I think this is critical functionality - in particular since the existing implementation does not seem to work on Android 7 as far as I can tell.

@achs0

achs0 commented Mar 7, 2018

Copy link
Copy Markdown

I'm a little confused. It seems, that this is implemented in phonegap (the "mirror" of cordova):
https://github.com/phonegap/phonegap-plugin-battery-status

@janpio

janpio commented Mar 7, 2018

Copy link
Copy Markdown
Member

That is a fork of this plugin:

This branch is 15 commits ahead, 33 commits behind apache:master.

So while someone did 15 commits on the fork, it also didn't get 33 commits that happened here.

@macdonst

macdonst commented Mar 7, 2018

Copy link
Copy Markdown
Member

@achs0 @janpio yeah, we forked the plugin so we could update the API as part of our rejuvenation campaign of plugin api's. The plan was to send a PR to the cordova battery status plugin once we had android, ios and windows done. We have a partial windows implementation but it's not ready yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants