onDestroy() called each time of auto-lock or home button press
Hi all, We're transplanting our huge 3D game to Amazon devices using NDK and it's almost done. but we encounter a weird problem on fire phone: if the screen is auto-locked, or the home button is pressed, the app will receive an onDestroy() event. even if this event won't be processed (totally ignore it), then after unlock the screen, app still receive window/view destroy & create messages multiple times (about 4 times or so), that will take the app about 10 secs to restore. here's a reference:
http://stackoverflow.com/questions/6772988/ondestroy-gets-called-each-time-the-screen-goes-on but I tried it and other similar approaches, they just don't work. our project configuration in AndroidManifest.xml is android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize" I really don't have any clue about this, do you guys know why fire phone has this problem? other devices like HDX7, HDX8.9, and FireTV don't have such a problem.
I ran into this problem testing our app this week. What seems to be happening is that when you hibernate the device, it is forcing (at least for us) the ap into portait mode (even though we do not support portrait), which is causing a screen resize. In our manifest we were not setting the flag to handle screen resize so a onDestroy was generated. So in our app manifest we now have an entry like: android:configChanges="keyboardHidden|orientation|screenLayout|screenSize" This seems to have resolved our issue. Hope this helps.
Thanks, that's the way I mentioned at the beginning. actually it works, the reason why it didn't work before is that, we have multiple activities in the AndroidManifest.xml, and one of the key activity is missing the "android:configChanges" line, my bad :D so problem solved, thank you again.