QtAndroidPrivate 名稱空間

QtAndroidPrivate 名稱空間提供輔助 Android 開發的雜項函數。 更多...

頭: #include <QtCore/private/qandroidextras_p.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS CorePrivate)
target_link_libraries(mytarget PRIVATE Qt6::CorePrivate)
qmake: QT += core-private
Since: Qt 6.2
狀態: 預備

此命名空間在開發且可能改變。

類型

(從 6.2 起) 枚舉類 BindFlag { None, AutoCreate, DebugUnbind, NotForeground, AboveClient, …, ExternalService }
flags BindFlags

函數

(從 6.2 起) 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 )
(從 6.2 起) void startActivity (const QAndroidIntent & intent , int receiverRequestCode , QAndroidActivityResultReceiver * resultReceiver = nullptr)
(從 6.2 起) void startActivity (const QJniObject & intent , int receiverRequestCode , QAndroidActivityResultReceiver * resultReceiver = nullptr)
(從 6.2 起) void startActivity (const QJniObject & intent , int receiverRequestCode , std::function<void (int, int, const QJniObject &)> callbackFunc )
(從 6.2 起) void startIntentSender (const QJniObject & intentSender , int receiverRequestCode , QAndroidActivityResultReceiver * resultReceiver = nullptr)

詳細描述

類型文檔編製

[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 文檔編製瞭解更多細節。

該枚舉在 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 文檔編製瞭解更多細節。

該函數在 Qt 6.2 引入。

另請參閱 QAndroidIntent , QAndroidServiceConnection ,和 BindFlag .

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

此函數在開發且可能改變。

校驗此進程是否擁有命名 permission 並返迴 QFuture 錶示校驗結果。

注意: QPermission is the recommended API to use for requesting permissions. If QPermission doesn't cover an Android permission you want to request, this preliminary API can still used instead.

該函數在 Qt 6.2 引入。

另請參閱 requestPermission ().

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

此函數在開發且可能改變。

請求 permission 並返迴 QFuture 錶示請求結果。

注意: QPermission is the recommended API to use for requesting permissions. If QPermission doesn't cover an Android permission you want to request, this preliminary API can still used instead.

該函數在 Qt 6.2 引入。

另請參閱 checkPermission ().

[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() 方法為 QNativeInterface::QAndroidApplication::context () will be called. Otherwise 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.

該函數在 Qt 6.2 引入。

[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() 方法為 QNativeInterface::QAndroidApplication::context () will be called. Otherwise 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.

該函數在 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 .

該函數在 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() 方法為 QNativeInterface::QAndroidApplication::context () will be called. Otherwise 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.

該函數在 Qt 6.2 引入。