Epson BT-2000 Developers Guide - Page 163
Acquiring Battery Information
View all Epson BT-2000 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 163 highlights
9.2. Acquiring Battery Information Use the Filter intent broadcast by the operating system, and acquire the battery information. Usage examples are displayed below. ■ Register the receiver of the battery information broadcast by the app IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_BATTERY_CHANGED); registerReceiver(mBroadcastReceiver, filter); ■ Acquire broadcast battery information Example: Acquiring the amount of power remaining, status, and installation status for battery A @Override public void onReceive(Context context, Intent intent){ int level_a = intent.getIntExtra(BatteryManager.EXTRA_LEVEL_A, 0); String status_a = intent.getStringExtra(BatteryManager.EXTRA_STATUS_A); boolean present_a = intent.getBooleanExtra(BatteryManager.EXTRA_PRESENT_A, false); MOVERIO Pro Developer's Guide (Rev.1.0) 159