In my last post Fixing the fullscreen orientation bug in AIR 3.x I mentioned how to fix the fullscreen AIR issue when changing orientation.
What has now come to light is that while that issue is fixed, there are still issues with orientation changes.
The problem I found is that an orientation change from portrait to landscape works, but orientation back to portrait fails indeterminately: sometimes the app would re-orient and sometimes not.
After a significant amount of research I discovered that a missing value in the android:configChanges attribute on the main Activity seems to be the cause of this.
From Android 3.2 an additional value: "screenSize" is available and should be responded to if your are handling config changes yourself with respect to screen orientation.
To fix this, follow the steps in the previous post but also change the android:configChanges attribute to:
Additionally it seems that APKTool can be unreliable in repacking the APK.
A work around for this follows:
- Unpack using APKTool.
- Make appropriate manifest changes.
- Re-pack to a temporary apk.
- Remove the AndroidManifest.xml from your original APK.
- Remove the contents of the root/META-INF folder from your original APK.
- Extract the fixed AndroidManifest.xml from the re-packed APK and add it to the root of the original APK.
- Re-sign the original APK as per the previous post.
This will preserve all resources, effectively just swapping out the manifest.
These fixes seems to have reliably solved the orientation bugs.