I have written an application that plays music, using AndEngine. The annoying problem is that, when user presses power button or when screen automatically turns off, after pressing power button again, the application restarts and does not resume. I found I have written an application that plays music,