Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,784,212 Members 42,386 Now Online
XDA Developers Android and Mobile Development Forum

[Q] How to get charge current value from Nexus 5?

Tip us?
 
11alex11
Old
#1  
Senior Member - OP
Thanks Meter 38
Posts: 208
Join Date: Jan 2011
Default [Q] How to get charge current value from Nexus 5?

I found that the charge current of almost all the devices being written to a file system location.

I found that file in Nexus 5 but the problem that the value is changing and not permanent. This is the path of the file: /sys/class/power_supply/battery/current_now

Anyone knows how to get permanent charge current value?
Check Out My Android App:
Battery Monitor - Monitor each battery % duration time

If you enjoyed my App please Rate it 5
 
MasterAwesome
Old
#2  
MasterAwesome's Avatar
Senior Member
Thanks Meter 752
Posts: 1,117
Join Date: Jun 2013
Quote:
Originally Posted by 11alex11 View Post
I found that the charge current of almost all the devices being written to a file system location.

I found that file in Nexus 5 but the problem that the value is changing and not permanent. This is the path of the file: /sys/class/power_supply/battery/current_now

Anyone knows how to get permanent charge current value?
File file= new file(pathtodir/hello.txt) ;
Process process = Runtime.getRuntime().exec(new String[] { "su", "-c", "cat /sys/class/power_supply/battery/capacity > hello.txt"});
BufferedReader br = new BufferedReader(new FileReader(file)); String line; while ((line = br.readLine()) != null) { //toast your battery here } br.close();


Regards
MasterAwesome
“Be yourself; everyone else is already taken.”― Oscar Wilde
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes