}elseif (mBatteryProps.chargerUsbOnline) { //Usb链接状态 mPlugType = BatteryManager.BATTERY_PLUGGED_USB; }elseif (mBatteryProps.chargerWirelessOnline) { //无线充电状态 mPlugType = BatteryManager.BATTERY_PLUGGED_WIRELESS; }else { //未充电状态 mPlugType = BATTERY_PLUGGED_NONE; } processValuesLo...
BatteryPluggedType 表示连接的充电器类型的枚举。 系统能力:SystemCapability.PowerManager.BatteryManager.Core 名称 值 说明 NONE 0 表示连接充电器类型未知。 AC 1 表示连接的充电器类型为交流充电器。 USB 2 表示连接的充电器类型为USB。 WIRELESS 3 表示连接的充电器类型为无线充电器。 Batt...
BatteryPluggedType 表示连接的充电器类型的枚举。 系统能力:SystemCapability.PowerManager.BatteryManager.Core 名称 值 说明 NONE 0 表示连接充电器类型未知。 AC 1 表示连接的充电器类型为交流充电器。 USB 2 表示连接的充电器类型为USB。 WIRELESS 3 表示连接的充电器类型为无线充电器。 Battery...
=mLastInvalidCharger))//插入状态有更改366if(mPlugType!=mLastPlugType){367if(mLastPlugType==BATTERY_PLUGGED_NONE){368// 不充电-->充电369370// There's no value in this data unless we've discharged at least once and the371// battery level has changed; so don't log until it does.372...
= mLastInvalidCharger))//插入状态有更改366if(mPlugType != mLastPlugType) {367if(mLastPlugType == BATTERY_PLUGGED_NONE) {368// 不充电-->充电369370// There's no value in this data unless we've discharged at least once and the371// battery level has changed; so don't log until ...
欢迎开发小伙伴们进来帮帮楼主
“status”(int类型)…状态,定义值是BatteryManager.BATTERY_STATUS_XXX。“health”(int类型)…健康,定义值是BatteryManager.BATTERY_HEALTH_XXX。“present”(boolean类型)“level”(int类型)…电池剩余容量 “scale”(int类型)…电池最大值。通常为100。“icon-small”(int类型)…图标ID。“plugged”(...
{mPlugType=BatteryManager.BATTERY_PLUGGED_AC;}elseif(mBatteryProps.chargerUsbOnline){mPlugType=BatteryManager.BATTERY_PLUGGED_USB;}elseif(mBatteryProps.chargerWirelessOnline){mPlugType=BatteryManager.BATTERY_PLUGGED_WIRELESS;}else{mPlugType=BATTERY_PLUGGED_NONE;}...//Step:2try{mBatteryStats.setBattery...
= mLastInvalidCharger)) //插入状态有更改 366 if (mPlugType != mLastPlugType) { 367 if (mLastPlugType == BATTERY_PLUGGED_NONE) { 368 // 不充电-->充电 369 370 // There's no value in this data unless we've discharged at least once and the 371 // battery level has changed; ...
mBatteryStats.setOnBattery(mPlugType == BATTERY_PLUGGED_NONE, mBatteryLevel); } catch (RemoteException e) { // Should never happen. } int icon = getIcon(mBatteryLevel); intent.putExtra("status", mBatteryStatus); intent.putExtra("health", mBatteryHealth); ...