Chosen Solution

When the charger is plugged into the device the device works fine but when plugged out it dies shortly after.

If the device turns on when the charging cord is plugged in, but immediately shuts off when you disconnect the device. Then, I believe that you may have a faulty battery, since the charging port and cable appear to be working properly. I would recommend looking into replacing your battery.