Reputation: 2831
Basically, the question is in the title.
Example:
<?xml version="1.0"?>
<manifest package="org.example.test" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.1" android:versionCode="1" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.StartActivity" android:label="@string/app_name" android:screenOrientation="sensorLandscape" android:launchMode="singleTop" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Background running -->
<!-- Warning: changing this value to true may cause unexpected crashes if the
application still try to draw after
"applicationStateChanged(Qt::ApplicationSuspended)"
signal is sent! -->
<meta-data android:name="android.app.background_running" android:value="true"/>
</activity>
</application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="19"/>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
</manifest>
It is used in QT apps for Android, but I thought it has nothing to do with QT since it is in manifest. Am I wrong?
Upvotes: 2
Views: 1730
Reputation: 2831
Since this option has really nothing to do with Android API as I thought before, I started digging into QT sources what that means.
Setting this option will export QT_BLOCK_EVENT_LOOPS_WHEN_SUSPENDED
environment variable, which will be checked by QT native code and will stop event dispatcher (no QCoreApplication::processEvents
will be called since then) for QT part of the app when the main Activity was stopped or paused by onStop(
) and onPause()
methods. So that is what means "freezing" the event loop.
I don't know of all cautions one should be aware of, but I will update my answer as soon as I find it out.
Upvotes: 2
Reputation: 18112
After long search this is what I found
What does this option do?
Setting android.app.background_running to true
means don’t freeze the Qt main loop, but you must make sure you don’t draw anything when the application is backgrounded.
This SO answer says how can we change its default value QT 5 android, Change background_running value to True
Upvotes: 1