이 페이지에서

QAndroidServiceConnection Class

Android ServiceConnection 클래스의 가장 중요한 메서드들을 감싸고 있습니다. 더 보기...

헤더: #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부터
상태: 기술 미리보기

이 클래스는 기술 미리보기 단계에 있으며 변경될 수 있습니다.

공개 함수

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

상세 설명

QAndroidServiceConnection은 AndroidServiceConnection 인터페이스를 래핑하는 편의 추상 클래스입니다.

QtAndroidPrivate::bindService 작업을 수행할 때 유용합니다.

멤버 함수 문서

QAndroidServiceConnection::QAndroidServiceConnection()

새로운 객체를 생성합니다

[explicit] QAndroidServiceConnection::QAndroidServiceConnection(const QJniObject &serviceConnection)

기존의 serviceConnection 객체를 기반으로 새로운 객체를 생성합니다.

이 기능은 자체 Java 구현을 사용할 때 유용합니다. 물론 onServiceConnected()/onServiceDisconnected() 메서드는 더 이상 호출되지 않습니다.

QJniObject QAndroidServiceConnection::handle() const

밑줄을 반환합니다 QJniObject

[pure virtual] void QAndroidServiceConnection::onServiceConnected(const QString &name, const QAndroidBinder &serviceBinder)

이 알림은 클라이언트가 서비스에 성공적으로 연결되었을 때 호출됩니다. ` name `에는 서버 이름이 포함되어 있으며, ` serviceBinder `는 클라이언트가 IPC 작업을 수행하는 데 사용하는 바인더입니다.

경고: 이 메서드는 이 객체가 생성된 스레드와는 다른 Binder의 스레드에서 호출됩니다.

밑줄을 반환합니다. QJniObject

[pure virtual] void QAndroidServiceConnection::onServiceDisconnected(const QString &name)

서비스와의 연결이 끊어졌을 때 호출됩니다. ` name ` 매개변수는 어떤 연결이 끊어졌는지를 지정합니다.

경고: 이 메서드는 Binder의 스레드에서 호출되며, 이는 이 객체가 생성된 스레드와 다릅니다.

기본값을 반환합니다. QJniObject

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