Detect State of Charge of Lithium-ion

I am building a battery pack charger for the iPhone, and need to know a way to detect the state of charge of the iPhone’s internal battery, so that I could stop charging it when it’s completely charged.

I’m confused why- the iPhone’s internal charging controller will do that by itself.

If you are charging the battery inside the phone, then the phone’s internal circuitry will handle the charging algorithm for you. All you need to do is supply it with a constant voltage of 5 volts with a current of up to 1 amp.

If you are charging the battery outside the phone, lithium ion batteries are generally charged with a constant current until the voltage reaches its maximum value. Then a constant voltage is applied and the current is monitored until it drops below a certain threshold. Getting the technical data sheets for the battery from the manufacturer will show you the algorithm and will probably even have a pretty graph in it showing the voltage charge curve and the decreasing current curve.

The battery pack charger will connect to the USB. While connected to the USB, there are two batteries that need to get charged. The iPhone’s internal battery, and the battery pack inside the charger.
When plugged in, I want the current from the USB to first charge the iPhone, and then, once the iPhone is completely charged, direct the current to the battery pack.

Essentially I need a circuit or component that can help me detect whether the iPhone is fully charged or not.

When the iPhone is done charging, does it continue to draw current? If it doesn’t could you just set up some circuitry to keep an eye on the current going into the iPhone? When it stops drawing, redirect it to your other battery.

The iPhone does continue to draw a reduced current when fully charged (100mA instead of 500mA)
Is there someway to measure this and then cause the switch, like may be using a current comparator?