Chosen Solution

Recently I have charged my iPhone 4 and when power drained, it shutted down when I charged it, it marked 2% and kept on shutting down randomly. I have tried to reset all settings when it was on but it didn’t work. I am plugging it but still it keeps on shutting every now and then. Can someone please help?

Considering the age of the iPhone 4, I would suspect a dead battery is causing your problem. To be certain, use a battery utility, such as coconutBattery (for Mac) or 3uTools (for Windows). It will tell you what the health of the battery is. Anything less than 70% of design capacity will require replacement. You can find the replacement guide here.