Also check the charging port for dust. In my own experience (your mileage may vary), removing the (compacted) dust and fluff from the connector reduced the occurrence of the problem. I used a sowing needle as compressed air wasn’t doing the trick; be careful not to damage anything if you try this.