My iPhone 4 suddenly shuts off?

It won't turn on. When I plug it on computer or charge it directly, the apple logo keeps appearing on and off but it won't turn on. It happens already before, i reset it and deleted everything on my phone and after a couple of weeks it shuts off again. When I plug my rechargeable backup battery, it would open but for only a couple of minutes and would shut off again when I unplug it. I don't want to go to apple store if possible, so is there anyone who could help me?

Maybe it is a battery problem. Maybe the hardware connection is loose. Bring it to a phone store or to Apple if you have warranty. Don't open the phone your self