C
Qt Android Notifications Listener
Getting Started
To include the definitions of the module's classes, use the following directive for C++:
#include <QtAndroidNotificationsListener>
To use the QML types in Qt Android Notifications Listener, add the following import statement to your .qml file:
import QtAndroidAutomotive.AndroidNotificationsListener
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 AndroidNotificationsListener) target_link_libraries(mytarget PRIVATE Qt::AndroidNotificationsListener)
Building with qmake
Add androidnotificationslistener
to the QT
variable:
QT += androidnotificationslistener
Modifying the manifest
To enable the notifications listener service, the service will need to be declared in the app's AndroidManifest.xml
:
<service android:name="io.qt.qaa.androidnotificationslistener.QtNotificationListener" android:enabled="true" android:exported="true" android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"> <intent-filter> <action android:name="android.service.notification.NotificationListenerService" /> </intent-filter> </service>
This is necessary to make the app visible as a notification listener to Android. Without it, the app will not be visible in the notification access settings page, and cannot be granted access to notifications from it.
API Reference
Links to the API reference materials:
Examples
Uses the Qt Android Notifications Listener QML API to make an interactive notifications list. |
Known issues and limitations
Checking whether access to notifications has been granted requires Android API 27 or higher to work properly.
Available under certain Qt licenses.
Find out more.