aboutsummaryrefslogtreecommitdiffstats
path: root/src/androidextras/android/qandroidfunctions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/androidextras/android/qandroidfunctions.cpp')
-rw-r--r--src/androidextras/android/qandroidfunctions.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/androidextras/android/qandroidfunctions.cpp b/src/androidextras/android/qandroidfunctions.cpp
index a5ed23d..1d1aa44 100644
--- a/src/androidextras/android/qandroidfunctions.cpp
+++ b/src/androidextras/android/qandroidfunctions.cpp
@@ -43,6 +43,7 @@
#include "qandroidactivityresultreceiver_p.h"
#include "qandroidintent.h"
#include "qandroidserviceconnection.h"
+#include "qandroidactivitycallbackresultreceiver_p.h"
#include <QtCore/private/qjni_p.h>
#include <QtCore/private/qjnihelpers_p.h>
@@ -181,6 +182,45 @@ void QtAndroid::startActivity(const QAndroidJniObject &intent,
}
/*!
+ \since 5.13
+
+ Starts the activity given by \a intent and provides the result asynchronously through the
+ \a resultReceiver if this is non-null.
+
+ If \a resultReceiver is null, then the \c startActivity() method in the \c androidActivity()
+ will be called. Otherwise \c startActivityForResult() will be called.
+
+ The \a receiverRequestCode is a request code unique to the \a resultReceiver, and will be
+ returned along with the result, making it possible to use the same receiver for more than
+ one intent.
+
+ */
+void QtAndroid::startActivity(const QAndroidIntent &intent,
+ int receiverRequestCode,
+ QAndroidActivityResultReceiver *resultReceiver)
+{
+ startActivity(intent.handle(), receiverRequestCode, resultReceiver);
+}
+
+/*!
+ \since 5.13
+
+ Starts the activity given by \a intent using \c startActivityForResult() and provides the result by calling callbackFunc.
+
+ The \a receiverRequestCode is a request code unique to the \a resultReceiver, and will be
+ returned along with the result, making it possible to use the same receiver for more than
+ one intent.
+*/
+void QtAndroid::startActivity(const QAndroidJniObject &intent,
+ int receiverRequestCode,
+ std::function<void(int, int, const QAndroidJniObject &data)> callbackFunc)
+{
+ QAndroidJniObject activity = androidActivity();
+ QAndroidActivityCallbackResultReceiver::instance()->registerCallback(receiverRequestCode, callbackFunc);
+ startActivity(intent, receiverRequestCode, QAndroidActivityCallbackResultReceiver::instance());
+}
+
+/*!
\since 5.3
Starts the activity given by \a intentSender and provides the result asynchronously through the