QAndroidService Class

Header: #include <QAndroidService>
qmake: QT += androidextras
Since: Qt 5.10

Public Functions

QAndroidService(int &argc, char **argv)
QAndroidService(int &argc, char **argv, const std::function<QAndroidBinder *(const QAndroidIntent &)> &binder)
virtual ~QAndroidService()
virtual QAndroidBinder *onBind(const QAndroidIntent &intent)

Detailed Description

The QAndroidService is a convenience class that wraps the most important Android Service methods.

Member Function Documentation

QAndroidService::QAndroidService(int &argc, char **argv)

Creates a new Android service, passing argc and argv as parameters.

See also QCoreApplication.

QAndroidService::QAndroidService(int &argc, char **argv, const std::function<QAndroidBinder *(const QAndroidIntent &)> &binder)

Creates a new Android service, passing argc and argv as parameters.

binder is used to create a binder when needed.

See also QCoreApplication.

[virtual] QAndroidService::~QAndroidService()

Destroys the instance of QAndroidService. The destructor is virtual.

[virtual] QAndroidBinder *QAndroidService::onBind(const QAndroidIntent &intent)

The user must override this method and to return a binder.

The intent parameter contains all the caller information.

The returned binder is used by the caller to perform IPC calls.

Warning: This method is called from Binder's thread which is different from the thread that this object was created.

See also QAndroidBinder::onTransact and QAndroidBinder::transact.