I can't think of a method that would work for all phones. You could try measuring the current and see how much it drops as the battery gets charged. You could also try reducing the supply voltage. As the battery charges, its voltage increases, and the difference between the supply voltage and the battery voltage reduces. Often that will cause the charging current to reduce. With a slightly lower supply voltage, you might find that the current reduces at a lower state of charge.
If current does drop as the battery approaches full charge, then you will just have to make a circuit to monitor the current and to turn off when the current is low enough.