App Inventor Extensions: Battery Manager | Pura Vida Apps

App Inventor Extensions


Battery Manager Extension SDK 34 ready!

See the App Inventor Extensions document about how to use an App Inventor Extension.

For questions about this extension or bug reports please start a new thread in the App Inventor community. Thank you.

For feature requests please contact me by email. To be a sponsor of a new method already is possible starting from only 10 USD! With your contribution you will help the complete App Inventor community. Thank you.

Jun 20th, 2016: Version 1 of the Battery Manager Extension released for App Inventor version nb149 and Companion version 2.37.

Aug 11th, 2016: Version 1a: avoid DX execution failed error: build each extension separately

March 11th, 2019: Version 2: CurrentNow, CurrentAvg, Capacity, ChargeCounter, EnergyCounter, Technology added

Aug 24th, 2021: Version 3: Dropdown helper blocks added.

Note: this release is not compatible with the previous version. Only use the extension for new projects.

Description

Battery Manager extension.
Required permissions: none

Properties


Returns the current health constant.
Possible values are: cold, dead, good, overheat, over voltage, unknown, unspecified failure.


Returns the battery level.
Possible values are between 0% and 100%.


Returns the battery plugged status.
Possible values are: usb, ac, wireless or unknown.


Returns the battery status.
Possible values are: charging, full, discharging, not charging or unknown.


Returns the battery temperature in celcius.


Returns the battery voltage level in millivolts.


Returns remaining battery capacity as an integer percentage of total capacity (with no fractional part).
Requires API Level 21, Android 5, Lollipop.
Thank you Tal for being the sponsor of this property.


Returns average battery current in microamperes, as an integer. Positive values indicate net current entering the battery from a charge source, negative values indicate net current discharging from the battery. The time period over which the average is computed may depend on the fuel gauge hardware and its configuration.
Requires API Level 21, Android 5, Lollipop.
Thank you Tal for being the sponsor of this property.


Returns Instantaneous battery current in microamperes, as an integer. Positive values indicate net current entering the battery from a charge source, negative values indicate net current discharging from the battery.
Requires API Level 21, Android 5, Lollipop.
Thank you Tal for being the sponsor of this property.


Returns Battery capacity in microampere-hours, as an integer. If the platform does not provide the property queried, this value will be Long.MIN_VALUE.
Requires API Level 21, Android 5, Lollipop.
Thank you Tal for being the sponsor of this property.


Returns Battery remaining energy in nanowatt-hours, as a long integer. If the platform does not provide the property queried, this value will be Long.MIN_VALUE.
Requires API Level 21, Android 5, Lollipop.
Thank you Tal for being the sponsor of this property.


Returns the battery technology.
Thank you Tal for being the sponsor of this property.

Events


Event indicating that battery changed.

Example App: Battery Information


Test

Tested successfully on Samsung Galaxy A5 (2017) running Android 8.

For questions about App Inventor,
please ask in the App Inventor community.Thank you.

Terms and Conditions

Download


Developing and maintaining snippets, tutorials and extensions for App Inventor takes a lot of time.
I hope it saved some of your time. If yes, then you might consider to donate a small amount!

Donation amount:

or donate some mBTC to Bitcoin Address:
1Jd8kXLHu2Vkuhi15TWHiQm4uE9AGPYxi8
Bitcoin

Thank you! Taifun
 

Download TaifunBattery extension V2 (aix file)
Download TaifunBattery extension V3 (aix file)
Download Battery Information Test V3 (aia file)
Back to top of page ...

Creative Commons License
This work by Pura Vida Apps is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.


Home | Snippets | Tutorials | Extensions | Links | Search | Privacy Policy | Contact