WEB开发网
开发学院手机开发Android 开发 Android中电池信息(Battery information)的取得 阅读

Android中电池信息(Battery information)的取得

 2010-09-10 00:41:00 来源:WEB开发网   
核心提示:056 case BatteryManager.BATTERY_STATUS_UNKNOWN:057 statusString = "unknown";058 break;059 case BatteryManager.BATTERY_STATUS_CHARGING:060 statusString

056 case BatteryManager.BATTERY_STATUS_UNKNOWN:

057 statusString = "unknown";

058 break;

059 case BatteryManager.BATTERY_STATUS_CHARGING:

060 statusString = "charging";

061 break;

062 case BatteryManager.BATTERY_STATUS_DISCHARGING:

063 statusString = "discharging";

064 break;

065 case BatteryManager.BATTERY_STATUS_NOT_CHARGING:

066 statusString = "not charging";

067 break;

068 case BatteryManager.BATTERY_STATUS_FULL:

069 statusString = "full";

070 break;

071 }

072

073 String healthString = "";

074

075 switch (health) {

076 case BatteryManager.BATTERY_HEALTH_UNKNOWN:

077 healthString = "unknown";

078 break;

079 case BatteryManager.BATTERY_HEALTH_GOOD:

080 healthString = "good";

081 break;

082 case BatteryManager.BATTERY_HEALTH_OVERHEAT:

083 healthString = "overheat";

084 break;

085 case BatteryManager.BATTERY_HEALTH_DEAD:

086 healthString = "dead";

087 break;

088 case BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE:

089 healthString = "voltage";

090 break;

091 case BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE:

092 healthString = "unspecified failure";

093 break;

094 }

095

096 String acString = "";

097

098 switch (plugged) {

099 case BatteryManager.BATTERY_PLUGGED_AC:

100 acString = "plugged ac";

101 break;

102 case BatteryManager.BATTERY_PLUGGED_USB:

103 acString = "plugged usb";

104 break;

105 }

106

107 Log.v("status", statusString);

108 Log.v("health", healthString);

上一页  1 2 3 4  下一页

Tags:Android 电池 信息

编辑录入:coldstar [复制链接] [打 印]
赞助商链接