[Q] get battery percentage - Android Software Development

I have looked up a lot of different examples of how to read what the current percentage of a battery is, but I can never get it to work. Whats the easiest way to find out what percentage the battery is at?
thanks in advance!

hyperbyteX said:
I have looked up a lot of different examples of how to read what the current percentage of a battery is, but I can never get it to work. Whats the easiest way to find out what percentage the battery is at?
thanks in advance!
Click to expand...
Click to collapse
hxxp://mihaifonoage.blogspot.com/2010/02/getting-battery-level-in-android-using.html <-- easy way to show battery level - tested (change hxxp for http ofc ;> ).

Related

% Battery instead of icon

Hi.
Anybody knows app or tool to change the battery icon by an % one?.
Thank you.
this would be helpful to me.
I use Battery Status
I use these files :
dont remember the thread, but the idea comes from schaps who develop ROMs for Hermes and Kaiser.
Usage : Install SDKCerts.cab, then PK%20White%2BColorNewWarningClean3GCompressed.cab , and SoftReset.
To uninstall : Uninistall PK%20White%2BColorNewWarningClean3GCompressed in Program Manager, Then RemoveSDKCerts.cab, SoftReset.
It looks good, the battery charge is indicated with 10% steps.
Vrdsp0 said:
I use these files :
dont remember the thread, but the idea comes from schaps who develop ROMs for Hermes and Kaiser.
Usage : Install SDKCerts.cab, then PK%20White%2BColorNewWarningClean3GCompressed.cab , and SoftReset.
To uninstall : Uninistall PK%20White%2BColorNewWarningClean3GCompressed in Program Manager, Then RemoveSDKCerts.cab, SoftReset.
It looks good, the battery charge is indicated with 10% steps.
Click to expand...
Click to collapse
Great Vrdsp0, thanks for that. It's exactly what I was looking for...
That is a great piece of software, really like. Thanks Heaps.
Excellent app, cheers for posting it and props to whoever made it.
Been looking for a lightweight freeware way to do this for ages.
any screenshot please??
i agree, i would also like to see a screenshot as well as a more detailed description of this app.
thanks!
it doesn't show the right percent of battery, this app shows 90%, but Battery Status shows 82 %, soft reset 2 times, still same
Edit, i need to disable Battery Status, in order for this app works properly, it's great
ariandax said:
any screenshot please??
Click to expand...
Click to collapse
http://i3.tinypic.com/6wymnvc.png
look at the battery on top of screen, it shows the % of battery
how do i disable the battery status so it works properly?
it says 100% and my status says ive got about 92%
It shows the level in steps of 10% and rounds up.
Eg
91%-100% = 100%
81%-90% = 90%
etc
I assume this is because its actually an image thats switched every 10%, not an actual live meter per se. Still, I find the battery meter is only accurate +/- 10% anyways, so no difference really.
it shows in incriments of 10 bc thats how the stock microsoft battery manangement is designed. battery status does it differently. the battery icons are nothing more than images in phcanoverbmp.dll, pretty easy edit. pics are in original thread those cabs were found in.
edit: this is not a app. it is just overwriting the default battery icons by using a dll. the battery icons shown have been created by me and bennec83 but the technique was first used my schaps and someone else who i cant seem to remember the username of. me and bennec just created new icons. same dll is used for clean 3g icons, call history icons, and pin pad if i remember correctly.
It is on increments of 10% because that's how the Hermes' battery management works. And that's where it was first modified for.
waichai said:
http://i3.tinypic.com/6wymnvc.png
look at the battery on top of screen, it shows the % of battery
Click to expand...
Click to collapse
Tnx for screening
waichai said:
http://i3.tinypic.com/6wymnvc.png
look at the battery on top of screen, it shows the % of battery
Click to expand...
Click to collapse
Wow, what's that ROM?
After installing RemoveSdkCerts.cab, No sound in the Device...????
I have installed the sdkcerts.cab but after some time I noticed that my Battery Drains, I thought to remove & check out that this installation is not the problem? So have removed by RemoveSdkCerts.cab . After removing & soft reset I have noticed that my sound is totally gone. Even after dialling, Music Player.....No Sound. I was disturbed with that. Dont know what to do. Then after I have reinstalled sdkcerts.cab and I got back my sound.
If I want to remove this application/drivers then what to do? Is there such issue came....
Help me out
Mehul Patel
mehulpatel said:
I have installed the sdkcerts.cab but after some time I noticed that my Battery Drains, I thought to remove & check out that this installation is not the problem? So have removed by RemoveSdkCerts.cab . After removing & soft reset I have noticed that my sound is totally gone. Even after dialling, Music Player.....No Sound. I was disturbed with that. Dont know what to do. Then after I have reinstalled sdkcerts.cab and I got back my sound.
If I want to remove this application/drivers then what to do? Is there such issue came....
Help me out
Mehul Patel
Click to expand...
Click to collapse
i have also noticed that my battery is also draining quite fast... HTC Touch Pro. i have not uninstalled yet for fear of loosing sound... i have the stock bell rom and radio... im gonna give it a few days to see what happens with the battery...
Same here with D2. My battery drains. I have read in a few places that the sdkcerts don't do any harm, but it did the same thing with my X1. Are the certs device specific? Is there another way to install the battery icons?

Battery icons in 5% step?

Well i am trying without success to modify the status bar battery icons so they show the charge in 1% o mejor 5% steps
so far i modified stat_sys_battery_charge y stat_sys_battery, added the necessary battery icons where they belong. But after compiling and installing the notification bar battery icons still show in steps of 20%.
I assume that the Eiclar kernel is capable of that
I found after decompiling the framework a public.xml in /value. Do i have to add the new drawable new icons with unique ID's also in that one or do i miss something? Perhaps the service.jar?
Running Telus 3.11 on Milestone
I'm pretty sure the Milestone and Droid hardware is only capable of reporting battery status in 10% increments, so you unfortunately wouldn't be able to get 1 or 5 no matter what you do
Penguissimo said:
I'm pretty sure the Milestone and Droid hardware is only capable of reporting battery status in 10% increments, so you unfortunately wouldn't be able to get 1 or 5 no matter what you do
Click to expand...
Click to collapse
Noticed that also after some tests
Penguissimo said:
I'm pretty sure the Milestone and Droid hardware is only capable of reporting battery status in 10% increments, so you unfortunately wouldn't be able to get 1 or 5 no matter what you do
Click to expand...
Click to collapse
you sure? when the milestone battery level drop below 20%, it will display 20->15->10->5%, so the milestone hardware just support 10% increment at first 80% and support 5% increment at 20% level?
emprize said:
you sure? when the milestone battery level drop below 20%, it will display 20->15->10->5%, so the milestone hardware just support 10% increment at first 80% and support 5% increment at 20% level?
Click to expand...
Click to collapse
It does switch to 5% increments once you get below 20, but from everything I've read, this is also a hardware function. No way to go finer than 10% when you're above 20, unfortunately.
Penguissimo said:
It does switch to 5% increments once you get below 20, but from everything I've read, this is also a hardware function. No way to go finer than 10% when you're above 20, unfortunately.
Click to expand...
Click to collapse
CM can do 1% increments in it's settings(i havent use the setting since i changed my battery icons with %, so it could be not as fine as 1%), so there must be a way to do it
kakyoin said:
CM can do 1% increments in it's settings(i havent use the setting since i changed my battery icons with %, so it could be not as fine as 1%), so there must be a way to do it
Click to expand...
Click to collapse
There seams to be a way.
Problem is you don't have enough unused icons in /drawable-hdpi-v4. Te only possibility for new images is to add in /value/public.xml the needed battery icon names with ID's and create them than in /drawable-hdpi-v4. Than modify the battery xml's. CM does it that way. Doing that we than will know if 2.1 is capable of recognize 1% steps. Also question is to what are those ID's related.
This should do th job.
kakyoin said:
CM can do 1% increments in it's settings(i havent use the setting since i changed my battery icons with %, so it could be not as fine as 1%), so there must be a way to do it
Click to expand...
Click to collapse
The issue here is that the phone's hardware will only respond to queries for remaining battery with a certain set of values (100, 90, 80, 70, 60, 50, 40, 30, 20, 15, 10, 5). CM is certainly capable of displaying the battery value in finer increments, but this is more of a vestigal feature from its HTC-phone origins, as the Droid will never report any value other than those listed.
There are apps on the Market that estimate battery percentage to a finer degree (I think Battery Left widget is one of them?), but they don't get their information directly from the phone's power manager. Rather, they monitor your battery usage and voltage over time and produce an estimate based on this data.
This would be an awesome feature to have in a ROM, but it would require a bit more effort to implement than it would on a phone that reported battery percentage in 1% increments to begin with.
Penguissimo said:
The issue here is that the phone's hardware will only respond to queries for remaining battery with a certain set of values (100, 90, 80, 70, 60, 50, 40, 30, 20, 15, 10, 5).
Click to expand...
Click to collapse
how do you get it in 10% intervals?
mine only drops in 20%
did you modify the battery_stat?
kakyoin said:
how do you get it in 10% intervals?
mine only drops in 20%
did you modify the battery_stat?
Click to expand...
Click to collapse
Yes i have the following:
For stat: 0,5,15,20,30,40,50,60,70,80,90,100
For charging: 0,10,20, etc.
You need to change two xml files and change/replace some images.
kakyoin said:
how do you get it in 10% intervals?
mine only drops in 20%
did you modify the battery_stat?
Click to expand...
Click to collapse
In addition to Thomas_BA's advice on how to get all of these increments to show in the status bar (which some ROMs such as CyanogenMod have already done for you), you can also see your battery status in 10% increments by going to Settings:About Phone:Status.
Thomas_BA said:
Yes i have the following:
For stat: 0,5,15,20,30,40,50,60,70,80,90,100
For charging: 0,10,20, etc.
You need to change two xml files and change/replace some images.
Click to expand...
Click to collapse
Any chance of sharing those files?? I cant seem to get my modded framework res apk to work... Thanks in advance!
yayyap159 said:
Any chance of sharing those files?? I cant seem to get my modded framework res apk to work... Thanks in advance!
Click to expand...
Click to collapse
For Android 2.1:
Important:
Don't use the images on a CDMA phone
In case you have CDMA use some unused GsM signal images, rename the files and also the name in the xml files.
The zip file contains two decompiled (clear text) xml files and the necessary battery icons. Don't use them on a CDMA phone, as i changed some CDMA signal images to battery icons. I don't need them as i have a GsM phone.
Also you have to rename the image names. Just remove 00_,01_,etc. and C00_, C01_, etc. I have done so to show the image order regarding charging and statue.
Usage:
Decompile your framwork-res-apk. Copy the xml files into the dcompiled framwork-res (not the images), compile, rename framwork-res.apk to '...zip' and tan copy the images.
hi ..
where i should copy images ..
is ti work with 2.2.1 rom ?
mytouch11 said:
hi ..
where i should copy images ..
is ti work with 2.2.1 rom ?
Click to expand...
Click to collapse
In 2.1 copy them to res\drawable-hdpi
I haven't checked the xml files in 2.2.1 rom so i can't tell.

[Q] editing build.prop?

how can i edit my build.prop file to maximize battery life and get the most out of my hd2?
i've seen a lot of threads about editing the build/prop file for the droid x and whatnot. so im wondering if i can do the same for my hd2.
No?
Sent from my HTC HD2 using Tapatalk
There isn't very much inside build.prop which will save your battery.
There are many things which have much more effect on battery drain, such as:
- Screen brightness
- Sync intervals
- Live wallpaper
- Overclocking
- Amount of usage (constantly playing with your device like it was your pecker)
- Kernel
- The list could go on and on and on...
nobnut said:
- Amount of usage (constantly playing with your device like it was your pecker)
.
Click to expand...
Click to collapse
hahhahhahahahaahaha thanks bro
thanks or all informations

[Q] How to remove the CELL STANDBY without using ADB???

Is it possible? Can it be done without having to learn how to install and use ADB? And is it true that it lengthens battery life for the nook??? Thanks in advance!
les02jen17 said:
Is it possible? Can it be done without having to learn how to install and use ADB? And is it true that it lengthens battery life for the nook??? Thanks in advance!
Click to expand...
Click to collapse
Uninstall with titanium telephony.apk and phone.apk, in that order. You will get FC and just reboot then and you will be okay. Does it save battery life? That is up to speculation and probably not. Root explored can be used also to do it. Just delete these two files.
Airplane Mode WiFi Tool - https://market.android.com/details?id=net.geekherd.airplanemode&feature=search_result
life64x said:
Uninstall with titanium telephony.apk and phone.apk, in that order. You will get FC and just reboot then and you will be okay. Does it save battery life? That is up to speculation and probably not. Root explored can be used also to do it. Just delete these two files.
Click to expand...
Click to collapse
This is the correct answer.
I can't believe no one is being the voice of reason here.
Don't bother! It doesn't do anything for you.
http://forum.xda-developers.com/showthread.php?t=899861&highlight=phone.apk
It makes no difference, placebo at most.
photoassign said:
This is the correct answer.
Click to expand...
Click to collapse
Many times in life there is more than one correct answer. This is one of those times. Please keep that in mind the next time you choose to provide input.
it does not do anything but to free up some internal memory and give you more to run other apps..removing non needed crap that runs does do something....Drm apk..cmstats...setup...and many more items that are loaded that are not needed gives a healthy dose of memory back and general CPU efficiency
Jiggity Janx said:
Many times in life there is more than one correct answer. This is one of those times. Please keep that in mind the next time you choose to provide input.
Click to expand...
Click to collapse
The correct answer for one person may not be correct for another...you were rather harsh on him...let me get this straight...I gotta turn on airplane mode every time I start my nook and turn it off versus just turning it on and playing with it? Does not seem very practical now....imh..but then I dont disagree with the idea...I mean why load a program when you don't really need it?
life64x said:
The correct answer for one person may not be correct for another...you were rather harsh on him...let me get this straight...I gotta turn on airplane mode every time I start my nook and turn it off versus just turning it on and playing with it? Does not seem very practical now....imh..but then I dont disagree with the idea...I mean why load a program when you don't really need it?
Click to expand...
Click to collapse
The app I posted it is something that can be turned on once and will set airplane mode for cell while allowing wifi and bluetooth to function as normal however you want them set, even on a reboot.
It has been proven that many times removing cell (or other main) features can affect the ability to use other applications. My solution was clean, simple, and would affect nothing negatively. BTW, I was using it to avoid the wifi dropping issues that some have seen periodically since CM was first put on the NC. So in my case, it has been providing more than one useful capability.
I feel that people should open up their mind and follow up on other ideas before narrowing their and others minds to only one solution....
photoassign said:
This is the correct answer.
Click to expand...
Click to collapse
The correct answer would be to learn ADB, install the drives and do it manually.
life64x said:
it does not do anything but to free up some internal memory and give you more to run other apps..removing non needed crap that runs does do something....Drm apk..cmstats...setup...and many more items that are loaded that are not needed gives a healthy dose of memory back and general CPU efficiency
Click to expand...
Click to collapse
I'd just like to ask folks not to remove CMStats. Its obviously your prerogative but it helps CM developers track usage. This isn't just for bragging rights. These numbers help us in talks with OEMs to quantify the importance of things like open bootloaders and such. We are starting to see OEMs cooperate with CM and I think tracking usage has helped.
CMStats is not invasive and doesn't hog memory or CPU cycles. It is open source so you can feel free to verify my claims.

is there a battery mod for EH17?

the title explains what am I trying to look for.
lilxpoohbear said:
the title explains what am I trying to look for.
Click to expand...
Click to collapse
I have one from Jaronow on Bonsai that works on Hurricane 1.6 so it should work on most.
http://db.tt/wlq8XQ5
It is Blue circle with percentage.
You can copy the files from whoever's battery mod and overwrite them into your system files. (There are guides on this, if you're unsure what I'm talking about.)
The other easy way to make a custom battery icon without the know-how is to hit up the UOT Kitchen, select your battery icon in the battery icon mod and upload your system files that it requires. Also, try to think about everything you want to do in advance, to avoid continually abusing their server, or you can use what people have already created. It's an unbelievable theming tool.

Categories

Resources