From Qt Wiki
Jump to: navigation, search

This page contains informations about Android Services using Qt.

Add an AndroidManifest.xml

If you have not already, you will need to copy the android template files into your project. This can be done in Qt Creator with Projects (left bar) -> Build & Run -> Android / Build -> Build Android APK -> Create Templates. For more information, see .

Add the service to your manifest

Every service must be explicitly added to your manifest file, next you have an example:

<manifest package=...>
    <application android:....>
        <activity android:....>

        <service android:process=":qt" android:name="">
        <!-- android:process=":qt" is needed to force the service to run on a separate process than the Activity -->

            <!-- Application arguments -->
            <!-- meta-data android:name="" android:value="-service"/ -->
            <!-- Application arguments -->

            <!-- If you are using the same application (.so file) for activity and also for service, then you
                 need to use ** to pass some arguments to your service in order to know which
                 one is which.

            <!-- Application to launch -->
            <meta-data android:name="" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
            <!-- Application to launch -->

            <!-- Ministro -->
            <meta-data android:name="" android:resource="@array/qt_sources"/>
            <meta-data android:name="" android:value="default"/>
            <meta-data android:name="" android:resource="@array/qt_libs"/>
            <meta-data android:name="" android:resource="@array/bundled_libs"/>
            <!-- Ministro -->

            <!-- Deploy Qt libs as part of package -->
            <meta-data android:name="" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
            <meta-data android:name="" android:resource="@array/bundled_in_lib"/>
            <meta-data android:name="" android:resource="@array/bundled_in_assets"/>
            <!-- Deploy Qt libs as part of package -->

            <!-- Run with local libs -->
            <meta-data android:name="" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
            <meta-data android:name="" android:value="/data/local/tmp/qt/"/>
            <meta-data android:name="" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
            <meta-data android:name="" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
            <meta-data android:name="" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
            <!-- Run with local libs -->

            <!--  Messages maps -->
            <meta-data android:value="@string/ministro_not_found_msg" android:name=""/>
            <meta-data android:value="@string/ministro_needed_msg" android:name=""/>
            <meta-data android:value="@string/fatal_error_msg" android:name=""/>
            <!--  Messages maps -->

            <!-- Background running -->
            <meta-data android:name="" android:value="true"/>
            <!-- Background running -->