android-project/app/src/main/AndroidManifest.xml
author Sylvain Becker <sylvain.becker@gmail.com>
Mon, 07 Jan 2019 17:06:50 +0100
changeset 12511 0ef0e4cb7752
parent 12364 351a67dbe9c6
permissions -rw-r--r--
Android: don't allow multiple instance of SDLActivity

Default launch mode (standard) allows multiple instances of the SDLActivity.
( https://developer.android.com/guide/topics/manifest/activity-element#lmode )

Not sure this is intended in SDL as this doesn't work. There are static
variables in Java, in C code which make this impossible (allow one android_window) and
also Audio print errors.

There is also some code added in onDestroy as if it would be able to
re-initialize: https://hg.libsdl.org/SDL/rev/56e9c709db7e

Bug Android activity life-cycle seems to show there is not transition to get out
of onDestroy()
https://developer.android.com/reference/android/app/Activity#ActivityLifecycle

( can be tested with "adb shell am start my.package.org/.MainActivity"
and "adb shell am start -n my.package.org/.MainActivity" )

Send me a message if there are real use-case for this !
     1 <?xml version="1.0" encoding="utf-8"?>
     2 <!-- Replace com.test.game 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     <!-- OpenGL ES 2.0 -->
    12     <uses-feature android:glEsVersion="0x00020000" />
    13 
    14     <!-- Touchscreen support -->
    15     <uses-feature
    16         android:name="android.hardware.touchscreen"
    17         android:required="false" />
    18 
    19     <!-- Game controller support -->
    20     <uses-feature
    21         android:name="android.hardware.gamepad"
    22         android:required="false" />
    23 
    24     <!-- External mouse input events -->
    25     <uses-feature
    26         android:name="android.hardware.type.pc"
    27         android:required="false" />
    28 
    29     <!-- Allow writing to external storage -->
    30     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    31     <!-- Allow access to the vibrator -->
    32     <uses-permission android:name="android.permission.VIBRATE" />
    33 
    34     <!-- if you want to capture audio, uncomment this. -->
    35     <!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->
    36 
    37     <!-- Create a Java class extending SDLActivity and place it in a
    38          directory under app/src/main/java matching the package, e.g. app/src/main/java/com/gamemaker/game/MyGame.java
    39  
    40          then replace "SDLActivity" with the name of your class (e.g. "MyGame")
    41          in the XML below.
    42 
    43          An example Java class can be found in README-android.md
    44     -->
    45     <application android:label="@string/app_name"
    46         android:icon="@mipmap/ic_launcher"
    47         android:allowBackup="true"
    48         android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    49         android:hardwareAccelerated="true" >
    50 
    51         <!-- Example of setting SDL hints from AndroidManifest.xml:
    52         <meta-data android:name="SDL_ENV.SDL_ACCELEROMETER_AS_JOYSTICK" android:value="0"/>
    53          -->
    54      
    55         <activity android:name="SDLActivity"
    56             android:label="@string/app_name"
    57             android:alwaysRetainTaskState="true"
    58             android:launchMode="singleInstance"
    59             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    60             >
    61             <intent-filter>
    62                 <action android:name="android.intent.action.MAIN" />
    63                 <category android:name="android.intent.category.LAUNCHER" />
    64             </intent-filter>
    65             <!-- Drop file event -->
    66             <!--
    67             <intent-filter>
    68                 <action android:name="android.intent.action.VIEW" />
    69                 <category android:name="android.intent.category.DEFAULT" />
    70                 <data android:mimeType="*/*" />
    71             </intent-filter>
    72             -->
    73         </activity>
    74     </application>
    75 
    76 </manifest>