包裹 Android ServiceConnection 类的最重要方法。 更多...
| 头: | #include <QtCore/private/qandroidextras_p.h> |
| qmake: | QT += core-private |
| Since: | Qt 6.2 |
| 状态: | Preliminary |
该类在开发且可能改变。
| QAndroidServiceConnection () | |
| QAndroidServiceConnection (const QJniObject & serviceConnection ) | |
| QJniObject | handle () const |
| virtual void | onServiceConnected (const QString & name , const QAndroidBinder & serviceBinder ) = 0 |
| virtual void | onServiceDisconnected (const QString & name ) = 0 |
The QAndroidServiceConnection is a convenience abstract class which wraps the AndroidServiceConnection 接口。
它很有用当履行 QtAndroidPrivate::bindService 操作。
当采用 CMake 构建时,使用以下命令来使用私有 Qt Core API:
find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::CorePrivate)
创建新对象
[explicit]
QAndroidServiceConnection::
QAndroidServiceConnection
(const
QJniObject
&
serviceConnection
)
创建新的对象从现有 serviceConnection .
It's useful when you have your own Java implementation. Of course onServiceConnected ()/ onServiceDisconnected () will not be called anymore.
返回下划线 QJniObject
[pure virtual]
void
QAndroidServiceConnection::
onServiceConnected
(const
QString
&
name
, const
QAndroidBinder
&
serviceBinder
)
This notification is called when the client managed to connect to the service. The name contains the server name, the serviceBinder is the binder that the client uses to perform IPC operations.
警告: 从 Binder 线程 (不同于创建此对象的线程) 调用此方法。
返回下划线 QJniObject
[pure virtual]
void
QAndroidServiceConnection::
onServiceDisconnected
(const
QString
&
name
)
Called when a connection to the Service has been lost. The name parameter specifies which connectioen was lost.
警告: 从 Binder 线程 (不同于创建此对象的线程) 调用此方法。
返回下划线 QJniObject