QtAndroidPrivate Namespace

The QtAndroidPrivate namespace provides miscellaneous functions to aid Android development. 更多...

头: #include <QtCore/private/qandroidextras_p.h>
qmake: QT += core-private
Since: Qt 6.2

This namespace is under development and is subject to change.

类型

枚举类 BindFlag { None, AutoCreate, DebugUnbind, NotForeground, AboveClient, …, ExternalService }
flags BindFlags

函数

bool bindService (const QAndroidIntent & serviceIntent , const QAndroidServiceConnection & serviceConnection , QtAndroidPrivate::BindFlags flags = BindFlag::None)
(preliminary) QFuture<QtAndroidPrivate::PermissionResult> checkPermission (const QString & permission )
(preliminary) QFuture<QtAndroidPrivate::PermissionResult> requestPermission (const QString & permission )
void startActivity (const QJniObject & intent , int receiverRequestCode , QAndroidActivityResultReceiver * resultReceiver = nullptr)
void startActivity (const QAndroidIntent & intent , int receiverRequestCode , QAndroidActivityResultReceiver * resultReceiver = nullptr)
void startActivity (const QJniObject & intent , int receiverRequestCode , std::function<void (int, int, const QJniObject &)> callbackFunc )
void startIntentSender (const QJniObject & intentSender , int receiverRequestCode , QAndroidActivityResultReceiver * resultReceiver = nullptr)

详细描述

When building with CMake, use the following commands to use private Qt Core APIs:

find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::CorePrivate)
					

类型文档编制

[since 6.2] enum class QtAndroidPrivate:: BindFlag
flags QtAndroidPrivate:: BindFlags

此枚举用于 QtAndroidPrivate::bindService 以描述履行绑定的模式。

常量 描述
QtAndroidPrivate::BindFlag::None 0x00000000 没有选项。
QtAndroidPrivate::BindFlag::AutoCreate 0x00000001 自动创建服务,只要绑定存在。见 BIND_AUTO_CREATE 文档编制了解更多细节。
QtAndroidPrivate::BindFlag::DebugUnbind 0x00000002 包括用于取消不匹配调用绑定的调试帮助。见 BIND_DEBUG_UNBIND 文档编制了解更多细节。
QtAndroidPrivate::BindFlag::NotForeground 0x00000004 Don't allow this binding to raise the target service's process to the foreground scheduling priority. See BIND_NOT_FOREGROUND 文档编制了解更多细节。
QtAndroidPrivate::BindFlag::AboveClient 0x00000008 Indicates that the client application binding to this service considers the service to be more important than the app itself. See BIND_ABOVE_CLIENT 文档编制了解更多细节。
QtAndroidPrivate::BindFlag::AllowOomManagement 0x00000010 Allow the process hosting the bound service to go through its normal memory management. See BIND_ALLOW_OOM_MANAGEMENT 文档编制了解更多细节。
QtAndroidPrivate::BindFlag::WaivePriority 0x00000020 Don't impact the scheduling or memory management priority of the target service's hosting process. See BIND_WAIVE_PRIORITY 文档编制了解更多细节。
QtAndroidPrivate::BindFlag::Important 0x00000040 This service is assigned a higher priority so that it is available to the client when needed. See BIND_IMPORTANT 文档编制了解更多细节。
QtAndroidPrivate::BindFlag::AdjustWithActivity 0x00000080 If binding from an activity, allow the target service's process importance to be raised based on whether the activity is visible to the user. See BIND_ADJUST_WITH_ACTIVITY 文档编制了解更多细节。
QtAndroidPrivate::BindFlag::ExternalService -2147483648 The service being bound is an isolated, external service. See BIND_EXTERNAL_SERVICE 文档编制了解更多细节。

This enum was introduced or modified in Qt 6.2.

BindFlags 类型是 typedef 对于 QFlags <BindFlag>。它存储 BindFlag 值的 OR (或) 组合。

函数文档编制

[since 6.2] bool QtAndroidPrivate:: bindService (const QAndroidIntent & serviceIntent , const QAndroidServiceConnection & serviceConnection , QtAndroidPrivate::BindFlags flags = BindFlag::None)

绑定服务给出通过 serviceIntent , serviceConnection and flagsserviceIntent 对象标识要连接的服务。 serviceConnection 是因启动和停止服务,接收信息的监听器。

返回 true 当成功时

Android documentation 文档编制了解更多细节。

This function was introduced in Qt 6.2.

另请参阅 QAndroidIntent , QAndroidServiceConnection ,和 BindFlag .

[since 6.2] QFuture < QtAndroidPrivate::PermissionResult > QtAndroidPrivate:: checkPermission (const QString & permission )

This function is under development and is subject to change.

Checks whether this process has the named permission 并返回 QFuture representing the result of the check.

This function was introduced in Qt 6.2.

另请参阅 requestPermission ().

[since 6.2] QFuture < QtAndroidPrivate::PermissionResult > QtAndroidPrivate:: requestPermission (const QString & permission )

This function is under development and is subject to change.

Requests the permission 并返回 QFuture representing the result of the request.

This function was introduced in Qt 6.2.

另请参阅 checkPermission ().

[since 6.2] void QtAndroidPrivate:: startActivity (const QJniObject & intent , int receiverRequestCode , QAndroidActivityResultReceiver * resultReceiver = nullptr)

Starts the activity given by intent and provides the result asynchronously through the resultReceiver if this is non-null.

resultReceiver 为 null,那么 startActivity() 方法在 androidActivity() 将被调用。否则 startActivityForResult() 将被调用。

The receiverRequestCode is a request code unique to the resultReceiver , and will be returned along with the result, making it possible to use the same receiver for more than one intent.

This function was introduced in Qt 6.2.

[since 6.2] void QtAndroidPrivate:: startActivity (const QAndroidIntent & intent , int receiverRequestCode , QAndroidActivityResultReceiver * resultReceiver = nullptr)

Starts the activity given by intent and provides the result asynchronously through the resultReceiver if this is non-null.

resultReceiver 为 null,那么 startActivity() 方法在 androidActivity() 将被调用。否则 startActivityForResult() 将被调用。

The receiverRequestCode is a request code unique to the resultReceiver , and will be returned along with the result, making it possible to use the same receiver for more than one intent.

This function was introduced in Qt 6.2.

[since 6.2] void QtAndroidPrivate:: startActivity (const QJniObject & intent , int receiverRequestCode , std::function < void ( int , int , const QJniObject &)> callbackFunc )

Starts the activity given by intent , using the request code receiverRequestCode , and provides the result by calling callbackFunc .

This function was introduced in Qt 6.2.

[since 6.2] void QtAndroidPrivate:: startIntentSender (const QJniObject & intentSender , int receiverRequestCode , QAndroidActivityResultReceiver * resultReceiver = nullptr)

Starts the activity given by intentSender and provides the result asynchronously through the resultReceiver if this is non-null.

resultReceiver 为 null,那么 startIntentSender() 方法在 androidActivity() 将被调用。否则 startIntentSenderForResult() 将被调用。

The receiverRequestCode is a request code unique to the resultReceiver , and will be returned along with the result, making it possible to use the same receiver for more than one intent.

This function was introduced in Qt 6.2.