Post Reply

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

30th May 2014, 06:33 AM   |  #1  
OP Senior Member
Thanks Meter: 38
 
208 posts
Join Date:Joined: Jan 2011
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?
1st June 2014, 08:48 PM   |  #2  
MasterAwesome's Avatar
Senior Member
Thanks Meter: 782
 
1,126 posts
Join Date:Joined: Jun 2013
More
Quote:
Originally Posted by 11alex11

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
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Java for Android App Development by ThreadRank