On this page

C

Qt for Android Automotive Service module

(Technical preview)

The Qt for Android Automotive Service module provides two main features for advanced multimedia and rendering capabilities in Android applications:

Rendering as a Service (RaaS)

The Rendering as a Service feature provides rendering capabilities that can be accessed from a service by multiple applications. This enables efficient resource sharing and centralized rendering management in Android systems.

A typical application using RaaS & Surface Streaming together

Key components include:

RaaS Platform Plugin

The RaaS platform plugin is a minimal Qt Platform Abstraction (QPA) implementation that enables QAndroidRaaSApplication and QAndroidSurfaceRenderEngine to render internally managed QWindow instances. These windows are backed by platform window objects that wrap the rendering to ANativeWindow instances.

QtRaaSApplication Java Class

QtRaaSApplication is the main interface responsible for loading a Qt Quick application and connecting the Java/Kotlin application to the rendering service. When used in an Android service, clients can connect through AIDL (or other IPC mechanisms) to invoke methods of an instance of this class. It provides functionality to bind or unbind Android surfaces and associate them with Qt Quick items from the loaded QML file via QAndroidRaaSApplication. It also enables dispatching touch events received from these surfaces to the corresponding Qt Quick items.

QAndroidSurfaceRenderEngine C++ Class

QAndroidSurfaceRenderEngine is responsible for loading the QML file and connecting to the Java layer through QAndroidRaaSApplication. It can also directly accept surfaces or ANativeWindow references, for example, from QAndroidSurfaceStreamer on the C++ side. It renders each requested QML item onto its corresponding bound surface.

Surface Streaming

The Surface Streaming feature enables low-latency video streaming from Android surfaces over the RTSP protocol. It uses an Android MediaCodec for efficient compression and is designed for scenarios where you need to stream display content from an Android device to another system or application.

Key capabilities include:

  • H.264 video codec support
  • Configurable video resolution and bitrate
  • RTSP server integration for streaming management
  • Flexible video format configuration (frame rate, encoding profiles)
  • Low-latency surface streaming with error handling

The main class for this feature is QAndroidSurfaceStreamer.

Getting Started

To use the Service module in your application:

#include <QtAndroidAutomotiveService>

Using the module

Using a Qt module requires linking against the module library, either directly or through other dependencies. CMake and qmake build tools are supported.

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 REQUIRED COMPONENTS AndroidAutomotiveService)
target_link_libraries(mytarget PRIVATE Qt::AndroidAutomotiveService)

Add the RaaS platform plugin to the target.

qt_import_plugins(mytarget
    INCLUDE Qt6::QAndroidRaaSIntegrationPlugin
)

Permissions

This module does not require any special or dangerous Android permissions to function correctly.

API reference

Links to the API reference materials:

Examples

Car Rendering Service Example

Demonstrates how to render multiple Qt Quick3D views in a service and simultaneously display them from surfaces managed by multiple activities.

Surface Streaming Example

Demonstrates how to render multiple Qt Quick 3D views in a service and display one of them from a surface managed by an activity while encoding and streaming the other through an RTSP/RTP connection.

Known issues and limitations

Available under certain Qt licenses.
Find out more.