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