QAndroidService Class
封装了 Android Service 类中最重要的一些方法。更多内容...
| 头文件: | #include <QtCore/private/qandroidextras_p.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS CorePrivate) target_link_libraries(mytarget PRIVATE Qt6::CorePrivate) |
| qmake: | QT += core-private |
| 自: | Qt 6.2 |
| 继承自: | QCoreApplication |
| 状态: | 技术预览 |
该类处于技术预览阶段,内容可能会有变动。
公共函数
| QAndroidService(int &argc, char **argv) | |
| QAndroidService(int &argc, char **argv, const std::function<QAndroidBinder *(const QAndroidIntent &)> &binder) | |
| virtual QAndroidBinder * | onBind(const QAndroidIntent &intent) |
详细说明
QAndroidService 是一个便利类,它封装了最重要的Android Service方法。
成员函数文档
QAndroidService::QAndroidService(int &argc, char **argv)
创建一个新的 Android 服务,并将argc 和argv 作为参数传递。
另请参阅 QCoreApplication 。
QAndroidService::QAndroidService(int &argc, char **argv, const std::function<QAndroidBinder *(const QAndroidIntent &)> &binder)
创建一个新的 Android 服务,并将argc 和argv 作为参数传入。
binder 用于在需要时创建binder 。
另请参阅 QCoreApplication 。
[virtual] QAndroidBinder *QAndroidService::onBind(const QAndroidIntent &intent)
用户必须重写此方法,并返回一个绑定器。
intent 参数包含所有调用者信息。
调用方将使用返回的绑定器来执行 IPC 调用。
警告:此 方法是从 Binder 的线程中调用的,该线程与创建此对象的线程不同。
© 2026 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.