/**
* 배터리 충전 중 여부 반환.
* @param context {@link Context}
* @return true : 충전 중, false : 충전 중 아님
*/
public static boolean isBatteryCharging(Context context){
Intent intentBattery = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
int status = intentBattery.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
boolean isCharging = false;
if(status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL){
isCharging = true;
}else if(status == BatteryManager.BATTERY_STATUS_NOT_CHARGING || status == BatteryManager.BATTERY_STATUS_DISCHARGING){
isCharging = false;
}
return isCharging;
}