QtAndroid Namespace

The QtAndroid namespace provides miscellaneous functions to aid Android development. More...

Header: #include <QtAndroid>
qmake: QT += androidextras
Since: Qt 5.3

Functions

QAndroidJniObject androidActivity()
int androidSdkVersion()
void startActivity(const QAndroidJniObject &intent, int receiverRequestCode, QAndroidActivityResultReceiver *resultReceiver = nullptr)
void startIntentSender(const QAndroidJniObject &intentSender, int receiverRequestCode, QAndroidActivityResultReceiver *resultReceiver = nullptr)

Detailed Description

The QtAndroid namespace provides miscellaneous functions to aid Android development.

Function Documentation

QAndroidJniObject QtAndroid::androidActivity()

Returns a handle to this applications main Activity

This function was introduced in Qt 5.3.

See also QAndroidJniObject.

int QtAndroid::androidSdkVersion()

Returns the Android SDK version. This is also known as the API level.

This function was introduced in Qt 5.3.

void QtAndroid::startActivity(const QAndroidJniObject &intent, int receiverRequestCode, QAndroidActivityResultReceiver *resultReceiver = nullptr)

Starts the activity given by intent and provides the result asynchronously through the resultReceiver if this is non-null.

If resultReceiver is null, then the startActivity() method in the androidActivity() will be called. Otherwise startActivityForResult() will be called.

The receiverRequestCode is a request code unique to the resultReceiver, and will be returned along with the result, making it possible to use the same receiver for more than one intent.

This function was introduced in Qt 5.3.

void QtAndroid::startIntentSender(const QAndroidJniObject &intentSender, int receiverRequestCode, QAndroidActivityResultReceiver *resultReceiver = nullptr)

Starts the activity given by intentSender and provides the result asynchronously through the resultReceiver if this is non-null.

If resultReceiver is null, then the startIntentSender() method in the androidActivity() will be called. Otherwise startIntentSenderForResult() will be called.

The receiverRequestCode is a request code unique to the resultReceiver, and will be returned along with the result, making it possible to use the same receiver for more than one intent.

This function was introduced in Qt 5.3.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/archives/qt-5.6/qtandroid.html