Worklight: Screen rotation causes an Android application to crash

Technote (troubleshooting)


Problem(Abstract)

Your appplication crashes on an Android device when the device supports an Android API level that is greater than or equal to 13.

Cause

When you create an Android environment for a Worklight application, Worklight automatically sets the minimum supported Android API level for your application. It uses the android:minSdkVersion attribute in AndroidManifest.xml file to set it to the lowest Android API level that is installed on your system. In the event that you wish to target a higher Android API Level use the android:targetSdkVersion attribute in the AndroidManifest.xml file, special care must be taken. When the target Android API level is greater than or equal to 13, a new configuration change named "screenSize" is sent to your application upon a screen rotation. Unless you specifically handle that event using the android:configChanges attribute in the AndroidManifest.xml file, your application crashes. It crashes when a screen rotation occurs on an Android device that supports an Android API level greater than or equal to 13.

Resolving the problem

Any Android application that targets an Android API level greater than or equal to 13 must include the "screenSize" configuration change in the android:configChanges attribute of AndroidManifest.xml.

Cross reference information
Segment Product Component Platform Version Edition
Mobile- Speech and Enterprise Access IBM Mobile Foundation Application Development Google Android 5.0.6 Consumer, Enterprise

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

IBM Worklight
Application Development

Software version:

5.0, 5.0.0.1, 5.0.0.3, 5.0.5, 5.0.5.1, 5.0.6

Operating system(s):

Google Android

Software edition:

Consumer, Enterprise

Reference #:

1628197

Modified date:

2013-03-12

Translate my page

Machine Translation

Content navigation