C

Qt Android Activity View

This module provides a C++ and a QML wrapper for the native ActivityView class. A Qt Quick plugin is provided to enable access using QML.

Android's ActivityView is a handy class for displaying Android's Activity inside another Activity. It provides proper rendering and events handling of the embedded app or activity out of the box. It creates the possibility for embedding one app into another. Such as, displaying a map app and a music player at the same time inside your app.

Using the Module

Using a Qt module requires linking against the module library, either directly or through other dependencies.

Building with CMake

Use the find_package() and target_link_libraries() commands to locate and link the needed module component from the Qt6 package:

find_package(Qt6 COMPONENTS AndroidActivityView)
target_link_libraries(mytarget PUBLIC Qt::AndroidActivityView)

Building with qmake

Add androidactivityview to the QT variable:

QT += androidactivityview

C++ API

To include the definitions of the module's classes, use the following directive for C++:

#include <QtAndroidActivityView>

QML API

For the QML types add the following import statement to your .qml file:

import QtAndroidAutomotive.ActivityView

API Reference

Links to the API reference materials:

Examples

Known issues and limitations

Only Android 10 and 11 are supported.

An ActivityView component is always rendered on top. It can be freely changed in size and position. However, the standard z-order rules do not apply. It is always rendered above all components rendered by QML. Additionally, it is also not possible to apply transformations such as rotation or scaling, changing the opacity or offscreen rendering using layers.

The Activity resolved by the provided packageName and className must have the resizeableActivity attribute set to true in order to be launched correctly as an embedded activity. Also, if the activity is not owned by the owner of this app, it must allow embedding. This rule also applies to activities launched from within embedded activities. Otherwise, new activities may not behave correctly, e.g. be launched in full screen.

Note: Because of this ActivityView should not be considered a general-purpose API. Apps to be embedded should be written with this criteria taken in mind. In the case of external apps, they should be thoroughly tested, especially in terms of starting new activities.

Available under certain Qt licenses.
Find out more.