Battery Intent API Reference

EMDK For Android 11.0

Overview

This document describes functionality of battery intent APIs of Zebra devices. It is intended for Android developers familiar with Android intent mechanisms and applies to devices running Android 4.4 KitKat and later.

On Zebra devices, battery information can be retrieved using Android battery intents just as on consumer devices. On devices equipped with Zebra Power Precision or Power Precision Plus batteries, additional information can be retrieved as indicated in the Battery Extras table shown below.

Also see Battery Intent API guide


Battery Extras

# Data Definitions Constant name Data type Format Power Precision Power Precision Plus Backup Battery
1 Battery Manufacture Date mfd String yyyy-mm-dd
2 Part number for battery prefix is ’21-” or “82-” for example: 21-xxxxx-01 Rev. X partnumber String Prefix-5 or 6 #s-suffix revision
3 Battery serial number; matches the value on the physical battery label serialnumber String Alpha followed by 4 numbers
4 Backup battery voltage bkvoltage Int units=mV
5 Rated capacity of the battery ratedcapacity Int units=mAh
6 Decommission status of the battery battery_decommission Int 0=Battery Good
1=Decommissioned Battery
2=Status Unknown
7 Cumulative charge using Zebra charging equipment only base_cumulative_charge Int units=mAh
8 Number of charge cycles battery_usage_numb Int
9 Cumulative charge using ALL (Zebra and Non-Zebra) charging equipment total_cumulative_charge Int units=mAh
10 Number of seconds passed since the battery was placed in a charger/terminal for the first time seconds_since_first_use Int units=secs
11 Maximum amount of charge that could be pulled from the battery under the present discharge conditions if the battery is fully charged present_capacity Int units=mAh
12 Battery health indicator in percentage (from 0–100) health_percentage Int units=%
13 Remaining time until the device becomes unusable under current discharge conditions. A value of 65535 indicates `time_to_empty` is unknown. time_to_empty Int units=mins
14 Time until battery is fully charged under present charging conditions. A value of 65535 indicates `time_to_empty` is unknown. time_to_full Int units=mins
15 Amount of usable charge remaining in the battery under current discharge conditions present_charge Int units=mAh
16 Level less than which battery is considered unhealthy battery_percent_decommission_threshold Int units=%
17 Charge-cycle count greater than which battery is considered unhealthy battery_usage_decommission_threshold Int units=Charge cycles

Programming Interface

Function Prototype


mIntent_Receiver = new Intent_Receiver();  
mIntentFilter = new IntentFilter();  
mIntentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);  
registerReceiver(mIntent_Receiver,mIntentFilter); 

Parameters

Please refer to the Android Battery Manager API.

Return Values

In addition to the battery information Android returns by default, some Zebra batteries return information for the following additional parameters:

  • bkvoltage
  • mfd
  • serialnumber
  • partnumber
  • ratedcapacity
  • battery_decommission
  • battery_usage_numb
  • health_percentage
  • present_capacity
  • base_cumulative_charge
  • total_cumulative_charge
  • present_charge
  • time_to_empty
  • time_to_full
  • seconds_since_first_use
  • battery_percent_decommission_threshold
  • battery_usage_decommission_threshold

See Battery Extras table above for usage info.

Example


public void onReceive(Context context, Intent intent) {      
    if (BATTERY_STATE_CHANGED_INTENT.equals(intent.getAction())) {          

        int bkvoltage = intent.getExtras().getInt("bkvoltage");  
        String mfd = intent.getExtras().getString("mfd");  
        String serialnumber = intent.getExtras().getString("serialnumber");  
        String partnumber = intent.getExtras().getString("partnumber");   
        int ratedcapacity = intent.getExtras().getInt("ratedcapacity");  
        int cycle = intent.getExtras().getInt("cycle");  

    }  
}