To understand how to optimize the life of your battery, you have to have in mind, very schematically, how a lithium-ion battery works. During charging, the anode (the + pole) will receive and accumulate electrons from the lithium placed at the cathode (the – pole). The current from the recharge somehow “rips” the energy present in the lithium. When the battery is no longer connected, the electrons will want to go the other way, which will produce the electric current. The fewer electrons left at the lithium level – i.e. the closer you get to the maximum charge – the more strain the battery is subjected to.
This is why it is accepted that the optimal recharge range for a lithium-ion battery is between 20 and 80%. In theory, it is therefore recommended to keep your phone within this range. This would mean that you have to recharge your smartphone as soon as it drops below 20% and disconnect it beyond 80%. In practice, it is more complicated. It is much more harmful to repeat recharges than to carry out a complete charge. Also, manufacturers have integrated technical limitations for several years.