How can I detect battery charging speed in android device? I can detect battery status using below code. but not charging speed.
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
BatteryChangeReceiver receiver = new BatteryChangeReceiver(subscriber);
registerReceiver(receiver, filter);
public class BatteryChangeReceiver extends BroadcastReceiver {
@Override public void onReceive(Context context, Intent intent) {
// here I get all battery status.
}
}
I also refer this,this and this but cant find the way to check charging speed.
There is an app (Ampere) that displaying charging speed. How can I achieve this?
Thanks in advance.
Check Your Phone's Spec Sheet Head over to the brand's site, select your phone and check the specifications section. Here, you can see the charging technology and power output (18W, 30W, 65W, and so on- the larger the number, the faster the charging). Most brands also mention the charger specifications.
Plug the USB multimeter into your port. The multimeter requires no external power, so as you plug it into the port it automatically turns on. You can see the results on your screen, it is just that simple. Voltage is measured in Volts (V), so you the results ending with V i.e 5V or something like it.
The average smartphone receives about 2.5W to 6W while charging from its USB port. Fast chargers raise that amount about 10 times, with some phones heading towards 120W! You should note that not all phones support fast charging and that all chargers aren't fast chargers.
Use the BatteryManager. It provides the property BATTERY_PROPERTY_CURRENT_AVERAGE, which gives you the average battery current in microamperes. Unfortunately, the time period over which this information is collected may differ from device to device. Negative values mean discharging, positive values mean the phone is charging.
Alternatively, you could use BATTERY_PROPERTY_CURRENT_NOW (it looks like Ampere is using this approach). It returns the instantaneous battery current. It may not be accurate, so calling this property a couple times and calculating the average seems like a good idea.
Example code:
BatteryManager batteryManager = (BatteryManager) Context.getSystemService(Context.BATTERY_SERVICE);
int averageCurrent = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_AVERAGE);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With