QAndroidIntent Class

Wraps the most important methods of Android Intent class. More...

Header: #include <QAndroidIntent>
qmake: QT += androidextras
Since: Qt 5.10

This class was introduced in Qt 5.10.

Public Functions

QAndroidIntent(const QAndroidJniObject &packageContext, const char *className)
QAndroidIntent(const QString &action)
QAndroidIntent(const QAndroidJniObject &intent)
QAndroidIntent()
QByteArray extraBytes(const QString &key)
QVariant extraVariant(const QString &key)
QAndroidJniObject handle() const
void putExtra(const QString &key, const QByteArray &data)
void putExtra(const QString &key, const QVariant &value)

Detailed Description

The QAndroidIntent is a convenience class that wraps the most important Android Intent methods.

Member Function Documentation

QAndroidIntent::QAndroidIntent(const QAndroidJniObject &packageContext, const char *className)

Creates a new intent and sets the provided packageContext and the service className. Example:

auto serviceIntent = QAndroidIntent(QtAndroid::androidActivity().object(), "com.example.MyService");

See also QtAndroid::androidActivity and QtAndroid::bindService.

QAndroidIntent::QAndroidIntent(const QString &action)

Creates a new intent and sets the provided action.

QAndroidIntent::QAndroidIntent(const QAndroidJniObject &intent)

Wraps the provided intent java object.

QAndroidIntent::QAndroidIntent()

Create a new intent

QByteArray QAndroidIntent::extraBytes(const QString &key)

Returns the extra key data from the Intent extras

QVariant QAndroidIntent::extraVariant(const QString &key)

Returns the extra key data from the Intent extras as a QVariant

QAndroidJniObject QAndroidIntent::handle() const

The return value is useful to call other Java API which are not covered by this wrapper

void QAndroidIntent::putExtra(const QString &key, const QByteArray &data)

Sets the key with the data in the Intent extras

void QAndroidIntent::putExtra(const QString &key, const QVariant &value)

Sets the key with the value in the Intent extras.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.