![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\preliminary \inmodule QtCorePrivate More...
Classes | |
| class | ActivityResultListener |
| class | NewIntentListener |
| class | ResumePauseListener |
| class | OnBindListener |
| class | GenericMotionEventListener |
| class | KeyEventListener |
| class | AndroidDeadlockProtector |
Enumerations | |
| enum class | BindFlag { None = 0x00000000 , AutoCreate = 0x00000001 , DebugUnbind = 0x00000002 , NotForeground = 0x00000004 , AboveClient = 0x00000008 , AllowOomManagement = 0x00000010 , WaivePriority = 0x00000020 , Important = 0x00000040 , AdjustWithActivity = 0x00000080 , ExternalService = -2147483648 } |
Functions | |
| Q_CORE_EXPORT QtJniTypes::Activity | activity () |
| Q_CORE_EXPORT QtJniTypes::Service | service () |
| Q_CORE_EXPORT QtJniTypes::Context | context () |
| Q_CORE_EXPORT JavaVM * | javaVM () |
| Q_CORE_EXPORT jint | initJNI (JavaVM *vm, JNIEnv *env) |
| Q_CORE_EXPORT jclass | findClass (const char *className, JNIEnv *env) |
| jobject | classLoader () |
| Q_CORE_EXPORT jint | androidSdkVersion () |
| bool | registerPermissionNatives (QJniEnvironment &env) |
| bool | registerNativeInterfaceNatives (QJniEnvironment &env) |
| Posts the function runnable to the Android thread. | |
| bool | registerExtrasNatives (QJniEnvironment &env) |
| Q_CORE_EXPORT void | handleActivityResult (jint requestCode, jint resultCode, jobject data) |
| Q_CORE_EXPORT void | registerActivityResultListener (ActivityResultListener *listener) |
| Q_CORE_EXPORT void | unregisterActivityResultListener (ActivityResultListener *listener) |
| Q_CORE_EXPORT void | handleNewIntent (JNIEnv *env, jobject intent) |
| Q_CORE_EXPORT void | registerNewIntentListener (NewIntentListener *listener) |
| Q_CORE_EXPORT void | unregisterNewIntentListener (NewIntentListener *listener) |
| Q_CORE_EXPORT void | registerGenericMotionEventListener (GenericMotionEventListener *listener) |
| Q_CORE_EXPORT void | unregisterGenericMotionEventListener (GenericMotionEventListener *listener) |
| Q_CORE_EXPORT void | registerKeyEventListener (KeyEventListener *listener) |
| Q_CORE_EXPORT void | unregisterKeyEventListener (KeyEventListener *listener) |
| Q_CORE_EXPORT void | handlePause () |
| Q_CORE_EXPORT void | handleResume () |
| Q_CORE_EXPORT void | registerResumePauseListener (ResumePauseListener *listener) |
| Q_CORE_EXPORT void | unregisterResumePauseListener (ResumePauseListener *listener) |
| Q_CORE_EXPORT void | waitForServiceSetup () |
| Q_CORE_EXPORT int | acuqireServiceSetup (int flags) |
| Q_CORE_EXPORT void | setOnBindListener (OnBindListener *listener) |
| Q_CORE_EXPORT jobject | callOnBindListener (jobject intent) |
| Q_CORE_EXPORT bool | acquireAndroidDeadlockProtector () |
| Q_CORE_EXPORT void | releaseAndroidDeadlockProtector () |
| Q_CORE_EXPORT bool | isUncompressedNativeLibs () |
| Q_CORE_EXPORT QString | resolveApkPath (const QString &fileName) |
| Q_CORE_EXPORT void | startIntentSender (const QJniObject &intentSender, int receiverRequestCode, QAndroidActivityResultReceiver *resultReceiver=nullptr) |
| Q_CORE_EXPORT void | startActivity (const QJniObject &intent, int receiverRequestCode, QAndroidActivityResultReceiver *resultReceiver=nullptr) |
| Q_CORE_EXPORT void | startActivity (const QAndroidIntent &intent, int receiverRequestCode, QAndroidActivityResultReceiver *resultReceiver=nullptr) |
| Q_CORE_EXPORT void | startActivity (const QJniObject &intent, int receiverRequestCode, std::function< void(int, int, const QJniObject &data)> callbackFunc) |
| Q_CORE_EXPORT bool | bindService (const QAndroidIntent &serviceIntent, const QAndroidServiceConnection &serviceConnection, BindFlags flags=BindFlag::None) |
\preliminary \inmodule QtCorePrivate
The QtAndroidPrivate namespace provides miscellaneous functions to aid Android development. \inheaderfile QtCore/private/qandroidextras_p.h
|
strong |
This enum is used with QtAndroidPrivate::bindService to describe the mode in which the binding is performed.
\value None No options. \value AutoCreate Automatically creates the service as long as the binding exist. See \l {https://developer.android.com/reference/android/content/Context.html#BIND_AUTO_CREATE} {BIND_AUTO_CREATE} documentation for more details. \value DebugUnbind Include debugging help for mismatched calls to unbind. See \l {https://developer.android.com/reference/android/content/Context.html#BIND_DEBUG_UNBIND} {BIND_DEBUG_UNBIND} documentation for more details. \value NotForeground Don't allow this binding to raise the target service's process to the foreground scheduling priority. See \l {https://developer.android.com/reference/android/content/Context.html#BIND_NOT_FOREGROUND} {BIND_NOT_FOREGROUND} documentation for more details. \value AboveClient Indicates that the client application binding to this service considers the service to be more important than the app itself. See \l {https://developer.android.com/reference/android/content/Context.html#BIND_ABOVE_CLIENT} {BIND_ABOVE_CLIENT} documentation for more details. \value AllowOomManagement Allow the process hosting the bound service to go through its normal memory management. See \l {https://developer.android.com/reference/android/content/Context.html#BIND_ALLOW_OOM_MANAGEMENT} {BIND_ALLOW_OOM_MANAGEMENT} documentation for more details. \value WaivePriority Don't impact the scheduling or memory management priority of the target service's hosting process. See \l {https://developer.android.com/reference/android/content/Context.html#BIND_WAIVE_PRIORITY} {BIND_WAIVE_PRIORITY} documentation for more details. \value Important This service is assigned a higher priority so that it is available to the client when needed. See \l {https://developer.android.com/reference/android/content/Context.html#BIND_IMPORTANT} {BIND_IMPORTANT} documentation for more details. \value AdjustWithActivity 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 \l {https://developer.android.com/reference/android/content/Context.html#BIND_ADJUST_WITH_ACTIVITY} {BIND_ADJUST_WITH_ACTIVITY} documentation for more details. \value ExternalService The service being bound is an isolated, external service. See \l {https://developer.android.com/reference/android/content/Context.html#BIND_EXTERNAL_SERVICE} {BIND_EXTERNAL_SERVICE} documentation for more details.
| Enumerator | |
|---|---|
| None | |
| AutoCreate | |
| DebugUnbind | |
| NotForeground | |
| AboveClient | |
| AllowOomManagement | |
| WaivePriority | |
| Important | |
| AdjustWithActivity | |
| ExternalService | |
Definition at line 211 of file qandroidextras_p.h.
| bool QtAndroidPrivate::acquireAndroidDeadlockProtector | ( | ) |
Definition at line 448 of file qjnihelpers.cpp.
| QtJniTypes::Activity QtAndroidPrivate::activity | ( | ) |
Definition at line 374 of file qjnihelpers.cpp.
| int QtAndroidPrivate::acuqireServiceSetup | ( | int | flags | ) |
Definition at line 424 of file qjnihelpers.cpp.
| jint QtAndroidPrivate::androidSdkVersion | ( | ) |
Definition at line 411 of file qjnihelpers.cpp.
| bool QtAndroidPrivate::bindService | ( | const QAndroidIntent & | serviceIntent, |
| const QAndroidServiceConnection & | serviceConnection, | ||
| BindFlags | flags = BindFlag::None ) |
Binds the service given by serviceIntent, serviceConnection and flags. The serviceIntent object identifies the service to connect to. The serviceConnection is a listener that receives the information as the service is started and stopped.
See \l {https://developer.android.com/reference/android/content/Context.html#bindService%28android.content.Intent,%20android.content.ServiceConnection,%20int%29} {Android documentation} documentation for more details.
Definition at line 991 of file qandroidextras.cpp.
| jobject QtAndroidPrivate::callOnBindListener | ( | jobject | intent | ) |
Definition at line 438 of file qjnihelpers.cpp.
| jobject QtAndroidPrivate::classLoader | ( | ) |
Definition at line 406 of file qjnihelpers.cpp.
| QtJniTypes::Context QtAndroidPrivate::context | ( | ) |
Definition at line 390 of file qjnihelpers.cpp.
References g_jActivity, and g_jService.
| jclass QtAndroidPrivate::findClass | ( | const char * | className, |
| JNIEnv * | env ) |
className must be slash-encoded
Definition at line 525 of file qjniobject.cpp.
| void QtAndroidPrivate::handleActivityResult | ( | jint | requestCode, |
| jint | resultCode, | ||
| jobject | data ) |
Definition at line 113 of file qjnihelpers.cpp.
| void QtAndroidPrivate::handleNewIntent | ( | JNIEnv * | env, |
| jobject | intent ) |
Definition at line 146 of file qjnihelpers.cpp.
| void QtAndroidPrivate::handlePause | ( | ) |
Definition at line 241 of file qjnihelpers.cpp.
| void QtAndroidPrivate::handleResume | ( | ) |
Definition at line 249 of file qjnihelpers.cpp.
| jint QtAndroidPrivate::initJNI | ( | JavaVM * | vm, |
| JNIEnv * | env ) |
Definition at line 279 of file qjnihelpers.cpp.
| bool QtAndroidPrivate::isUncompressedNativeLibs | ( | ) |
Definition at line 257 of file qjnihelpers.cpp.
| JavaVM * QtAndroidPrivate::javaVM | ( | ) |
Definition at line 401 of file qjnihelpers.cpp.
| void QtAndroidPrivate::registerActivityResultListener | ( | ActivityResultListener * | listener | ) |
Definition at line 101 of file qjnihelpers.cpp.
| bool QtAndroidPrivate::registerExtrasNatives | ( | QJniEnvironment & | env | ) |
Definition at line 693 of file qandroidextras.cpp.
| void QtAndroidPrivate::registerGenericMotionEventListener | ( | QtAndroidPrivate::GenericMotionEventListener * | listener | ) |
Definition at line 194 of file qjnihelpers.cpp.
| void QtAndroidPrivate::registerKeyEventListener | ( | QtAndroidPrivate::KeyEventListener * | listener | ) |
Definition at line 206 of file qjnihelpers.cpp.
| bool QtAndroidPrivate::registerNativeInterfaceNatives | ( | QJniEnvironment & | env | ) |
Posts the function runnable to the Android thread.
The function will be queued and executed on the Android UI thread. If the call is made on the Android UI thread runnable will be executed immediately. If the Android app is paused or the main Activity is null, runnable is added to the Android main thread's queue.
This call returns a QFuture<QVariant> which allows doing both synchronous and asynchronous calls, and can handle any return type. However, to get a result back from the QFuture::result(), QVariant::value() should be used.
If the runnable execution takes longer than the period of timeout, the blocking calls \l QFuture::waitForFinished() and \l QFuture::result() are ended once timeout has elapsed. However, if runnable has already started execution, it won't be cancelled.
The following example shows how to run an asynchronous call that expects a return type:
The following example shows how to run a synchronous call with a void return type:
Definition at line 235 of file qandroidnativeinterface.cpp.
| void QtAndroidPrivate::registerNewIntentListener | ( | NewIntentListener * | listener | ) |
Definition at line 134 of file qjnihelpers.cpp.
| bool QtAndroidPrivate::registerPermissionNatives | ( | QJniEnvironment & | env | ) |
| void QtAndroidPrivate::registerResumePauseListener | ( | ResumePauseListener * | listener | ) |
Definition at line 229 of file qjnihelpers.cpp.
| void QtAndroidPrivate::releaseAndroidDeadlockProtector | ( | ) |
Definition at line 453 of file qjnihelpers.cpp.
Definition at line 264 of file qjnihelpers.cpp.
| QtJniTypes::Service QtAndroidPrivate::service | ( | ) |
Definition at line 385 of file qjnihelpers.cpp.
| void QtAndroidPrivate::setOnBindListener | ( | QtAndroidPrivate::OnBindListener * | listener | ) |
Definition at line 430 of file qjnihelpers.cpp.
| 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.
If resultReceiver is null, then the startActivity() method of QNativeInterface::QAndroidApplication::context() will be called. Otherwise startActivityForResult() will be called.
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.
Definition at line 908 of file qandroidextras.cpp.
| 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.
If resultReceiver is null, then the startActivity() method of QNativeInterface::QAndroidApplication::context() will be called. Otherwise startActivityForResult() will be called.
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.
Definition at line 874 of file qandroidextras.cpp.
References QAndroidActivityResultReceiverPrivate::globalRequestCode().
| void QtAndroidPrivate::startActivity | ( | const QJniObject & | intent, |
| int | receiverRequestCode, | ||
| std::function< void(int, int, const QJniObject &data)> | callbackFunc ) |
Starts the activity given by intent, using the request code receiverRequestCode, and provides the result by calling callbackFunc.
Definition at line 921 of file qandroidextras.cpp.
References QAndroidActivityCallbackResultReceiver::instance(), and QAndroidActivityCallbackResultReceiver::registerCallback().
| 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.
If resultReceiver is null, then the startIntentSender() method of QNativeInterface::QAndroidApplication::context() will be called. Otherwise startIntentSenderForResult() will be called.
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.
Definition at line 946 of file qandroidextras.cpp.
References QAndroidActivityResultReceiverPrivate::globalRequestCode().
| void QtAndroidPrivate::unregisterActivityResultListener | ( | ActivityResultListener * | listener | ) |
Definition at line 107 of file qjnihelpers.cpp.
| void QtAndroidPrivate::unregisterGenericMotionEventListener | ( | QtAndroidPrivate::GenericMotionEventListener * | listener | ) |
Definition at line 200 of file qjnihelpers.cpp.
| void QtAndroidPrivate::unregisterKeyEventListener | ( | QtAndroidPrivate::KeyEventListener * | listener | ) |
Definition at line 212 of file qjnihelpers.cpp.
| void QtAndroidPrivate::unregisterNewIntentListener | ( | NewIntentListener * | listener | ) |
Definition at line 140 of file qjnihelpers.cpp.
| void QtAndroidPrivate::unregisterResumePauseListener | ( | ResumePauseListener * | listener | ) |
Definition at line 235 of file qjnihelpers.cpp.
| void QtAndroidPrivate::waitForServiceSetup | ( | ) |
Definition at line 419 of file qjnihelpers.cpp.