summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/androidjnimain.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-02-14 10:25:23 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-15 22:25:36 +0100
commit8d721b3c567aeecb04a39a3f75b76f5ef10db25c (patch)
tree807d3d48636d6cb87bc2578505f6710eb70026b8 /src/plugins/platforms/android/androidjnimain.cpp
parentc9cdbcb12f80cd72905e49ce1a673eae9f559ca3 (diff)
Android: Add enablers for listening to activity results
When you launch an activity through an intent, data can be provided back from the activity when it has finished using onActivityResult() in the activity which launched it. This is okay for applications, since they can easily create their own activities, but does not work for libraries that need to use intents. There is no listener API for activity results which allow external classes to eavesdrop. In order to support launching intents from third-party or add-on libraries, we provide a low-level way to hook into the activity result event. The corresponding public API will be added to QtAndroidExtras. Change-Id: I89417f485e2c0e69028dcccc7c155788346a7417 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
Diffstat (limited to 'src/plugins/platforms/android/androidjnimain.cpp')
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 337e7419aa..c904ddb3ac 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -71,6 +71,7 @@
#include <android/asset_manager_jni.h>
#include "qandroidassetsfileenginehandler.h"
#include <android/api-level.h>
+#include <QtCore/private/qjnihelpers_p.h>
#include <qpa/qwindowsysteminterface.h>
@@ -621,6 +622,14 @@ static void handleOrientationChanged(JNIEnv */*env*/, jobject /*thiz*/, jint new
}
}
+static void onActivityResult(JNIEnv */*env*/, jclass /*cls*/,
+ jint requestCode,
+ jint resultCode,
+ jobject data)
+{
+ QtAndroidPrivate::handleActivityResult(requestCode, resultCode, data);
+}
+
static JNINativeMethod methods[] = {
{"startQtAndroidPlugin", "()Z", (void *)startQtAndroidPlugin},
{"startQtApplication", "(Ljava/lang/String;Ljava/lang/String;)V", (void *)startQtApplication},
@@ -630,7 +639,8 @@ static JNINativeMethod methods[] = {
{"setSurface", "(ILjava/lang/Object;II)V", (void *)setSurface},
{"updateWindow", "()V", (void *)updateWindow},
{"updateApplicationState", "(I)V", (void *)updateApplicationState},
- {"handleOrientationChanged", "(II)V", (void *)handleOrientationChanged}
+ {"handleOrientationChanged", "(II)V", (void *)handleOrientationChanged},
+ {"onActivityResult", "(IILandroid/content/Intent;)V", (void *)onActivityResult}
};
#define FIND_AND_CHECK_CLASS(CLASS_NAME) \