android-project/AndroidManifest.xml
author Ryan C. Gordon <icculus@icculus.org>
Fri, 19 May 2017 15:06:05 -0400
changeset 11018 1f151426c2ca
parent 10280 985f92b2f8e9
child 11238 c728c661cec7
permissions -rw-r--r--
android: add screenSize to AndroidManifest's configChanges (thanks, Daniel!).

Fixes Bugzilla #3448.

"Starting with Android API 13, another configuration change must be declared
to be handled by the app if it is desired to not let the system handle
rotation itself:

https://developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange

This will have effect if either a developer or SDL per default will set target
API > 12. Currently it is set to 12, but this might change in the future, like
when applying this patch: https://bugzilla.libsdl.org/show_bug.cgi?id=3445

The effect of not having this change applied is that the SDL app is destroyed
upon rotation. Even when the manifest has an additional entry to e.g. always
stay in landscape mode, the onDestroy() call will happen on devices that are
portrait per default, when switching off screen due to power save. The device
will then (at least try to) rotate into portrait to show the portrait screen
lock after resume.

I believe it is safe to apply this patch even with target API still set to 12,
the additional parameter is simply ignored."
     1 <?xml version="1.0" encoding="utf-8"?>
     2 <!-- Replace org.libsdl.app with the identifier of your game below, e.g.
     3      com.gamemaker.game
     4 -->
     5 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     6       package="org.libsdl.app"
     7       android:versionCode="1"
     8       android:versionName="1.0"
     9       android:installLocation="auto">
    10 
    11     <!-- Android 2.3.3 -->
    12     <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="12" />
    13 
    14     <!-- OpenGL ES 2.0 -->
    15     <uses-feature android:glEsVersion="0x00020000" />
    16 
    17     <!-- Allow writing to external storage -->
    18     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    19 
    20     <!-- if you want to capture audio, uncomment this. -->
    21     <!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->
    22 
    23     <!-- Create a Java class extending SDLActivity and place it in a
    24          directory under src matching the package, e.g.
    25          	src/com/gamemaker/game/MyGame.java
    26 
    27          then replace "SDLActivity" with the name of your class (e.g. "MyGame")
    28          in the XML below.
    29 
    30          An example Java class can be found in README-android.md
    31     -->
    32     <application android:label="@string/app_name"
    33                  android:icon="@drawable/ic_launcher"
    34                  android:allowBackup="true"
    35                  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    36                  android:hardwareAccelerated="true" >
    37         <activity android:name="SDLActivity"
    38                   android:label="@string/app_name"
    39                   android:configChanges="keyboardHidden|orientation|screenSize"
    40                   >
    41             <intent-filter>
    42                 <action android:name="android.intent.action.MAIN" />
    43                 <category android:name="android.intent.category.LAUNCHER" />
    44             </intent-filter>
    45             <!-- Drop file event -->
    46             <!--
    47             <intent-filter>
    48                 <action android:name="android.intent.action.VIEW" />
    49                 <category android:name="android.intent.category.DEFAULT" />
    50                 <data android:mimeType="*/*" />
    51             </intent-filter>
    52             -->
    53         </activity>
    54     </application>
    55 
    56 </manifest>