Wraps the most important methods of Android Binder class. More...
Header: | #include <QAndroidBinder> |
CMake: | find_package(Qt6 COMPONENTS Core REQUIRED) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
Since: | Qt 6.2 |
This class is under development and is subject to change.
enum class | CallType { Normal, OneWay } |
QAndroidBinder(const QJniObject &binder) | |
QAndroidBinder() | |
QJniObject | handle() const |
virtual bool | onTransact(int code, const QAndroidParcel &data, const QAndroidParcel &reply, QAndroidBinder::CallType flags) |
bool | transact(int code, const QAndroidParcel &data, QAndroidParcel *reply = nullptr, QAndroidBinder::CallType flags = CallType::Normal) const |
The QAndroidBinder is a convenience class that wraps the most important Android Binder methods.
This enum is used with QAndroidBinder::transact() to describe the mode in which the IPC call is performed.
Constant | Value | Description |
---|---|---|
QAndroidBinder::CallType::Normal |
0 |
normal IPC, meaning that the caller waits the result from the callee |
QAndroidBinder::CallType::OneWay |
1 |
one-way IPC, meaning that the caller returns immediately, without waiting for a result from the callee |
Creates a new object from the binder Java object.
See also transact.
Creates a new object which can be used to perform IPC.
See also onTransact and transact.
The return value is useful to call other Java API which are not covered by this wrapper
[virtual]
bool QAndroidBinder::onTransact(int code, const QAndroidParcel &data, const QAndroidParcel &reply, QAndroidBinder::CallType flags)
Default implementation is a stub that returns false. The user should override this method to get the transact data from the caller.
The code is the action to perform. The data is the marshaled data sent by the caller. The reply is the marshaled data to be sent to the caller. The flags are the additional operation flags.
Warning: This method is called from Binder's thread which is different from the thread that this object was created.
See also transact.
Performs an IPC call
The code is the action to perform. Should be between FIRST_CALL_TRANSACTION and LAST_CALL_TRANSACTION. The data is the marshaled data to send to the target. The reply (if specified) is the marshaled data to be received from the target. May be nullptr if you are not interested in the return value. The flags are the additional operation flags.
Returns true on success
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.2/qandroidbinder.html