Android App disappearing on screen rotation

When you migrate an Android app written in Delphi XE8 to Delphi 10 Seattle it may just suddenly push itself to background when you rotate the screen.

The solution is simple; just let the Delphi 10 IDE re-generate the AndroidManifest.template.xml file, or modify the following line of code in the file:
XE8: android:configChanges=”orientation|keyboard|keyboardHidden”
10 Seattle: android:configChanges=”orientation|keyboard|keyboardHidden|screenSize”

Your Delphi 10 Seattle migrated Android App will now behave itself when rotating the screen. Problem solved!

If you are wondering about the how and why of this modification; the minimum SDK levels have changed between XE8 and 10 Seattle.
XE8: uses-sdk android:minSdkVersion=”9″
10 Seattle: uses-sdk android:minSdkVersion=”14″
and when we take a look here:
http://developer.android.com/guide/topics/manifest/activity-element.html#config you’ll note that if the API level for your App is higher than 12, rotating the screen will issue a restart of the activity, unless you set the screenSize configChanges parameter which will allow your App to handle a screenSize change, such as a rotation between portrait and landscape.