By detecting a voltage drop in resistor connected in series with the battery, we can measure the current flowing in or out  of the battery. A simple differential amplifier do that, but we need both positive supply and negative supply to sense the current in both direction,  the current when charging and discharging the battery. We can use a single supply by separating the circuit for each direction like shown in this circuit:

battery monitor circuit schematic

[Source: Linear Technology Application Notes]