Chosen Solution
Shuts offs randomly when i still got a charge in it. To start it back up i gotta press hard on the backside where the connection between the board and battery connects.
Had exact the same problem with my a40 last summer. There is a problem between the connection of your phone and battery, it has nothing to do with the percentage of your battery. You can try to let it fix, but I bought a new phone because the a40 is pretty cheap (not worth repairing) and it was a good moment for an upgrade.