Skip to content

Commit 7bf03dd

Browse files
authored
Try orientation unspecified and hard-lock it for phones to 'portrait'. Set 'auto-rotate' for tablets/foldables.
1 parent db62452 commit 7bf03dd

File tree

1 file changed

+27
-30
lines changed

1 file changed

+27
-30
lines changed

pythonforandroid/bootstraps/_sdl_common/build/templates/AndroidManifest.tmpl.xml

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
<?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-
-->
2+
<!-- AndroidManifest template for Kivy app, adaptive and compliant with Android 16+ -->
53
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
64
android:versionCode="{{ args.numeric_version }}"
75
android:versionName="{{ args.version }}"
86
android:installLocation="auto">
97

8+
<!-- Declare support for all screen sizes -->
109
<supports-screens
11-
android:smallScreens="true"
12-
android:normalScreens="true"
13-
android:largeScreens="true"
14-
android:anyDensity="true"
15-
{% if args.min_sdk_version >= 9 %}
16-
android:xlargeScreens="true"
17-
{% endif %}
10+
android:smallScreens="true"
11+
android:normalScreens="true"
12+
android:largeScreens="true"
13+
android:anyDensity="true"
14+
{% if args.min_sdk_version >= 9 %}
15+
android:xlargeScreens="true"
16+
{% endif %}
1817
/>
1918

20-
<!-- Android 2.3.3 -->
19+
<!-- SDK versions -->
2120
<uses-sdk android:minSdkVersion="{{ args.min_sdk_version }}" android:targetSdkVersion="{{ android_api }}" />
2221

2322
<!-- OpenGL ES 2.0 -->
2423
<uses-feature android:glEsVersion="0x00020000" />
2524

26-
<!-- Set permissions -->
25+
<!-- Permissions -->
2726
{% for perm in args.permissions %}
2827
<uses-permission android:name="{{ perm.name }}"{% if perm.maxSdkVersion %} android:maxSdkVersion="{{ perm.maxSdkVersion }}"{% endif %}{% if perm.usesPermissionFlags %} android:usesPermissionFlags="{{ perm.usesPermissionFlags }}"{% endif %} />
2928
{% endfor %}
@@ -38,16 +37,7 @@
3837

3938
{{ args.extra_manifest_xml }}
4039

41-
42-
<!-- Create a Java class extending SDLActivity and place it in a
43-
directory under src matching the package, e.g.
44-
src/com/gamemaker/game/MyGame.java
45-
46-
then replace "SDLActivity" with the name of your class (e.g. "MyGame")
47-
in the XML below.
48-
49-
An example Java class can be found in README-android.txt
50-
-->
40+
<!-- Application -->
5141
<application android:label="@string/app_name"
5242
{% if debug %}android:debuggable="true"{% endif %}
5343
android:icon="@mipmap/ic_launcher"
@@ -57,7 +47,10 @@
5747
{{ args.extra_manifest_application_arguments }}
5848
android:theme="{{args.android_apptheme}}{% if not args.window %}.Fullscreen{% endif %}"
5949
android:hardwareAccelerated="true"
60-
android:extractNativeLibs="true" >
50+
android:extractNativeLibs="true"
51+
android:resizeableActivity="true"
52+
android:supportsPictureInPicture="false">
53+
6154
{% for l in args.android_used_libs %}
6255
<uses-library android:name="{{ l }}" />
6356
{% endfor %}
@@ -66,15 +59,19 @@
6659
<meta-data android:name="{{ m.split('=', 1)[0] }}" android:value="{{ m.split('=', 1)[-1] }}"/>{% endfor %}
6760
<meta-data android:name="wakelock" android:value="{% if args.wakelock %}1{% else %}0{% endif %}"/>
6861

69-
<activity android:name="{{ args.android_entrypoint }}"
62+
<!-- Main activity -->
63+
<activity android:name="{{ args.android_entrypoint }}"
7064
android:label="@string/app_name"
7165
android:resizeableActivity="true"
72-
android:supportsPictureInPicture="true"
7366
android:exported="true"
7467
android:launchMode="{% if args.activity_launch_mode %}{{ args.activity_launch_mode }}{% else %}singleTask{% endif %}"
7568
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|uiMode|keyboardHidden|density|layoutDirection"
7669
android:windowSoftInputMode="adjustResize"
77-
android:screenOrientation="portrait">
70+
android:screenOrientation="unspecified">
71+
72+
<!-- Adaptive tablet/foldable metadata -->
73+
<meta-data android:name="android.max_aspect" android:value="2.1" />
74+
<meta-data android:name="android.resizeableActivity" android:value="true" />
7875

7976
<intent-filter>
8077
{% if args.launcher %}
@@ -108,7 +105,6 @@
108105
<action android:name="android.intent.action.MAIN" />
109106
<category android:name="android.intent.category.LAUNCHER" />
110107
</intent-filter>
111-
112108
</activity>
113109
{% endif %}
114110

@@ -137,9 +133,10 @@
137133
</intent-filter>
138134
</receiver>
139135
{% endif %}
140-
{% for a in args.add_activity %}
141-
<activity android:name="{{ a }}"></activity>
142-
{% endfor %}
136+
137+
{% for a in args.add_activity %}
138+
<activity android:name="{{ a }}"></activity>
139+
{% endfor %}
143140
</application>
144141

145142
</manifest>

0 commit comments

Comments
 (0)