I want my game to be able to continue from where its left before phone went to sleep(user press power button). My game work fine with home button. when user press home button and open game again, game start where it should be. But in the case user press power button(on google htc nexus one), it crashes. But when I test the game on samsung galaxy tablet 10, it works fine.
In LogCat
, I could observe that when the user presses power button on galaxy tablet, onPause() is called. and when user press again onResume() is called which is normal.
But on google nexus, when the user press power button, onPause(), onResume(),onPause() is called respectively before it went into sleep. And nothing gets called when the user press power button again.
Please advice how can I fix the problem. Thanks in advance
EDIT
Looks like this problem is observed only on device that have portrait orientation by default.