1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
5\page android-manifest-file-configuration.html
6\title Qt Android Manifest File Configuration
7\ingroup androidplatform
8\brief Provides details on the AndroidManifest.xml configuration.
9\previouspage android-openssl-support.html
10\nextpage android-services.html
12The Android Manifest is an XML file necessary for any Android app. It contains
13app configuration for different settings and features that the app use, as well
14as details on the app itself, such as, package name, app name, version, etc.
15Permissions and hardware features can also be set from the manifest.
17Qt for Android maintains a version of \c {AndroidManifest.xml} with default
18configuration that include features, permissions and other configuration
19used by the build system which are needed for building and running Qt apps
22\section1 Qt Project to Manifest Configuration
24Qt defines some \l {Android: App Manifest <meta-data>}{meta-data} that is passed
25from the build systems and to \l {Deploying an Application on Android}{androiddeployqt}
26which populates the manifest with the correct values without explicitly setting
27these in the manifest file. Such \l {Android: App Manifest <meta-data>}{meta-data}
28is assigned a value in the form \c {"-- %%INSERT_VALUE%% --"}, for example:
32 android:versionCode="-- %%INSERT_VERSION_CODE%% --"
37This would be populated with the version code that is set in, for example,
40\section1 Qt Default Configuration
42Qt sets the following manifest configuration by default:
50 \li {1, 5} \l {Android: App Manifest <manifest>}{<manifest>}
52 \li Sets the package name. The default value is \c {org.qtproject.example.app_name}.
54 \li \c {android:installLocation}
55 \li Sets the app's installation location, whether internal or external storage.
56 The default value is \c auto.
58 \li android:versionCode
59 \li Sets the internal version code. Populated from \c ANDROID_VERSION_CODE (qmake)
60 and \c QT_ANDROID_VERSION_CODE (CMake). The default value is \c 1.
62 \li android:versionName
63 \li Sets the public version name. Populated from \c ANDROID_VERSION_NAME (qmake)
64 and \c QT_ANDROID_VERSION_NAME (CMake). The default value is \c {1.0}.
66 \li \c {<supports-screens>}
67 \li Sets the screen sizes that the app supports,
68 default values are \c anyDensity, \c largeScreens,
69 \c normalScreens, and \c smallScreens.
71 \li {1, 7} \l {Android: App Manifest <application>}{<application>}
73 \li The application class name. Default value is
74 \c {org.qtproject.qt.android.bindings.QtApplication}.
77 \li The application name label. Default value is the Qt project's target name.
79 \li android:hardwareAccelerated
80 \li Sets hardware acceleration preference. The default value is \c true.
82 \li android:requestLegacyExternalStorage
83 \li Whether to use Android scoped storage. The default value is \c true.
85 \li android:allowNativeHeapPointerTagging
86 \li Whether or not the app has the Heap pointer tagging feature enabled.
87 This has to be set to \c false when targeting Arm64 hardware with Android 11+
88 because it can break QML's NaN-tagging scheme.
89 For more information, see \l {Android: Tagged Pointers}{Tagged Pointers}.
90 The default value is \c false.
92 \li android:allowBackup
93 \li Whether to allow the application to participate in the backup and restore
94 infrastructure. If this is set to \c false, no backup or restore of the
95 application will ever be performed. The default value is \c true.
97 \li android:fullBackupOnly
98 \li Whether or not to use Auto Backup on devices where it is available.
99 The default value is \c false.
101 \li {1, 7} \l {Android: App Manifest <activity>}{<activity>}
103 \li The activity class name. The default value is \c {org.qtproject.qt.android.bindings.QtActivity}.
106 \li The activity name label. Default value is the Qt project's target name.
108 \li android:configChanges
109 \li Lists configuration changes that the activity handles. Default value is
110 \c orientation, \c uiMode, \c screenLayout, \c screenSize,
111 \c smallestScreenSize, \c layoutDirection, \c locale, \c fontScale,
112 \c keyboard, \c keyboardHidden, \c navigation, \c mcc, \c mnc, \c density.
114 \li android:launchMode
115 \li The method used to launch the activity. The default value is \c singleTop.
117 \li android:screenOrientation
118 \li The orientation of the activity's display on the device. The default value is \c unspecified.
121 \li Specifies the types of intents that the activity can respond to. Default value is
123 <action android:name="android.intent.action.MAIN"/>
124 <category android:name="android.intent.category.LAUNCHER"/>
128 \li Sets whether the activity can be launched by components of other applications.
129 The default value is \c true.
132\section1 Qt Specific Meta-data
134In addition to the default manifest configuration that Qt sets, Qt defines
135some meta-data that is valid for Qt apps only. Such meta-data is usually
136under the \c <activity> section in the form:
140 android:name="meta-data-name"
141 android:value="meta-data-value" />
144The following is a list of such meta-data defined by Qt:
151 \target android.app.lib_name
152 \li android.app.lib_name
153 \li The filename of the native C++ library that is used by the activity.
154 \note This attribute is mandatory and shouldn't be removed.
155 Default value is the Qt project's target name.
157 \li android.app.extract_android_style
158 \li The method used to extract the native Android Style information.
159 For more information, see \l {Style Extraction}.
160 The default value is \c minimal.
162 \target android.app.background_running
163 \li android.app.background_running
164 \li Sets whether the app keeps running tasks in the background.
165 Setting this to \c true is the equivalent of setting the environment
166 variable \c QT_BLOCK_EVENT_LOOPS_WHEN_SUSPENDED to \c 0.
167 The default value is \c false.
169 \warning Setting this to \c true may cause unexpected crash if the
170 application tries to draw after \l {QGuiApplication::applicationStateChanged()}
171 signal is sent with a \l {Qt::ApplicationSuspended} state.
173 \target android.app.arguments
174 \li android.app.arguments
175 \li Sets a list of arguments to pass to the app \c {"arg1 arg2"}.
176 Populated from \c ANDROID_APPLICATION_ARGUMENTS (qmake) and
177 \c QT_ANDROID_APPLICATION_ARGUMENTS (CMake).
178 Default value is not set.
180 \li android.app.splash_screen_drawable_portrait
181 \li Sets a drawable for a splash screen specific to portrait mode.
182 For example: \c {android:resource="@drawable/splash_portrait"}.
183 Default value is not set.
185 \li android.app.splash_screen_drawable_landscape
186 \li Sets a drawable for a splash screen specific to landscape mode.
187 For example: \c {android:resource="@drawable/splash_landscape"}.
188 Default value is not set.
190 \li android.app.splash_screen_drawable
191 \li Sets a drawable for a splash screen at the start of the app.
192 \note Orientation specific splash screens are checked first,
193 if not set, this is used instead.
194 For example: \c {android:resource="@drawable/splash"}.
195 Default value is not set.
197 \li android.app.splash_screen_sticky
198 \li Sets whether the splash screen stays visible until explicitly hidden
200 For more information, see
201 \l {QNativeInterface::}{QAndroidApplication::hideSplashScreen()}.
203 \li android.app.trace_location
204 \li Specifies a location on device where the application can save tracing files.
205 For example: /storage/emulated/0/Android/data/<app_package_name>/files/.
206 This is needed when using Common Trace Format (CTF) tracing backend.
207 \note The application needs storage permission for the location.
211\section2 Application Specific Meta-data
213Some meta-data attributes are application-wide, and should be placed under
214the \c <application> section:
221 \target android.app.system_libs_prefix
222 \li android.app.system_libs_prefix
223 \li Specifies a custom system library path to use for library loading lookup.
224 This is necessary when using Qt libraries installed outside an app's
225 default native (JNI) library directory.
226 The default value is \c {/system/lib/}.
229\section2 Meta-data in Services
231Some meta-data attributes can also be used in \l {Android Services}{Services}.
235 \li \l {android.app.lib_name}
236 \li \l {android.app.background_running}
237 \li \l {android.app.arguments}
240\section2 Qt Permissions and Features
242Different Qt modules might require some Android permissions or features to
243function properly, for example, Camera permission in \l {QtMultimedia}.
244l{The androiddeployqt Tool} takes care of including such requirements into the
245Android manifest during the build. Qt defines the following lines into the
246manifest, which they get replaced by
251 <!-- %%INSERT_PERMISSIONS -->
252 <!-- %%INSERT_FEATURES -->
257\note If those lines are removed from the project manifest, Qt won't be
258able to include the correct permissions. So some functionalities
259might not work properly.
261\section2 Style Extraction
263Qt uses different methods to determine how Qt Widgets and Qt Quick Controls
267 \li \c default or \c full: when using Qt Widgets or Qt Quick Controls 1.
268 \note This method uses some Android non-SDK interfaces, that are being
269 restricted and removed by Google starting from Android 9.0 (API 28).
270 For that reason, this is not recommended for Android 9.0 or greater.
271 \li \c minimal: when using Qt Quick Controls 2 and no Qt Widgets or Qt Quick
272 Controls 1. This is faster than using the default or full options.
273 \li \c none: no style extraction.
276\section1 Qt Manifest before 6.2 Release
278Versions of Qt earlier than 6.2 used to have an additional set of meta-data
279defined by Qt. These attributes used to manage dependencies and some were
280used by the discontinued \c Ministro service. With Qt 6.2, they should be removed.
281Here is a list of these attributes:
284 \li android.app.qt_sources_resource_id
285 \li android.app.repository
286 \li android.app.bundled_libs_resource_id
287 \li android.app.bundle_local_qt_libs
288 \li android.app.use_local_qt_libs
289 \li android.app.libs_prefix
290 \li android.app.load_local_libs_resource_id
291 \li android.app.load_local_jars
292 \li android.app.static_init_classes
293 \li android.app.qt_libs_resource_id
294 \li android.app.ministro_not_found_msg
295 \li android.app.ministro_needed_msg
296 \li android.app.fatal_error_msg
299For more information on the Android Manifest, see
300\l{Android: App Manifest}{Android App Manifest}.