Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

QAndroidIntent Class

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

Header: #include <QtCore/private/qandroidextras_p.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS CorePrivate)
target_link_libraries(mytarget PRIVATE Qt6::CorePrivate)
qmake: QT += core-private
Since: Qt 6.2

This class is under development and is subject to change.

Public Functions

QAndroidIntent(const QJniObject &packageContext, const char *className)
QAndroidIntent(const QString &action)
QAndroidIntent(const QJniObject &intent)
QAndroidIntent()
QByteArray extraBytes(const QString &key)
QVariant extraVariant(const QString &key)
QJniObject 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 QJniObject &packageContext, const char *className)

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

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

See also QtAndroidPrivate::bindService.

QAndroidIntent::QAndroidIntent(const QString &action)

Creates a new intent and sets the provided action.

QAndroidIntent::QAndroidIntent(const QJniObject &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

QJniObject 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.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded