I have been messing around with Android NDK development for a while now, and I just recently got an animation viewer up and running as a NativeActivity App on my Android device.
One thing I was shocked to discover, though, is that when I hit the "Back" or "Home" buttons while running my device, my App is given the "APP_CMD_DESTROY" command, signaling it to exit the thread. I had assumed that when leaving an App, it retains a memory space which is restored when you return to that App. But from this behavior, it appears that my App will be restarted from scratch each time I enter and exit.
I read up a bit on the Android lifecycle, which seemed to confirm this behavior. The intent seemed to be using the "savedState" buffer to handle the restore myself. If this is really the intended flow, I now have a lot more respect for every native App that seamlessly transitions in and out. But if this is really true, then I'm wondering:
1) What is the max limit on the savedState size? I'm assuming I couldn't copy my entire allocated memory range, for example.
2) Assuming the above answer is fairly small, doesn't that imply that you need to reload all resources again? This seems like it would involve tons of loading time, even for a brief transition back to the main menu.
It just seems like I must be missing something. I'm curiow now how iOS handles this...
Thanks for any advice!