Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to check external battery with Android SDK?

Tags:

android

I would like to create an android app that checks the external battery state (charge via micro USB).

I have checked the BatteryManager, UsbAccessory and UsbManager classes it seems non functional.

So any hints?

Thank you.

like image 216
Cheung Avatar asked Feb 06 '14 11:02

Cheung


People also ask

How do you check battery on Android?

Check battery life & useOpen your phone's Settings app. Under "Battery," see how much charge you have left, and about how long it will last. For details, tap Battery. For a graph and list of battery use, tap Battery Usage.

How check battery consumption in Android programmatically?

Go to the activity_main. xml file, which represents the UI of the project. Add a Button, so whenever the user will click on the Button a Toast message with battery percentage will be popped up on the screen.

How do I check battery data?

Select Search on the taskbar, type Command prompt, press and hold (or right-click) Command prompt, and then select Run as administrator > Yes. At the command prompt, type powercfg /batteryreport, then press Enter. The battery report will be an HTML file that's stored in a folder on your PC.

How do I check battery health app?

Android has a few hidden codes that you can punch into your Phone app to access testing menus. One of these displays a variety of info about your device, including its battery health. To see it, open your dialer and type *#*#4636#*#*.


1 Answers

As far as the phone is concerned, an external battery is just a power source like a normal charger. There is no communication; in fact these external batteries short-circuit the two data pins of the USB port to signal their prescence. Since they also contain circuitry to produce constant 5v output voltage the phone has not even a theoretical chance of knowing the battery state. I'm sorry but you are fighting a losing battle here, you will only be able to tell whether the phone is still receiving sufficient power from the external battery or not.

like image 74
Chrissi Avatar answered Sep 17 '22 15:09

Chrissi