I am in need of a way to charge a 3.7V li-ion cell (probably an 18650 type) from a 4.5V - 20V input. That's not a problem, there are plenty of (switching) battery chargers around with that kind of operating range.
However, my difficulty now comes from the second requirement. The widget must be able to operate while charging drawing on average 250mA with 500mA peak load when the motors are operating.
Whilst in principle it sounds like all I need to do is draw current from the battery, this would interfere with the charging process, because the current measured would be different to what the battery is actually drawing. When in the constant-current stage (~90% of the charging process time) the current changing suddenly would alter the charge voltage. This probably wouldn't be too healthy for the battery. It's also likely to interfere with the C/10 cut-off.
What would be the best way to solve this problem?
I thought about using two ICs. One to charge the battery and a buck converter to run the electronics at ~4.5V, but this takes up space, and increases the cost of the widget, so I'd rather do it another way.