[CLOSED] is it possible to send notification from java to Qt?
-
Hi,
I have a java class as activity and I use some operation in that; I'd like to send a notification of a completed operation from within activity to Qt thru jni: is it that possible? -
Are you looking for something like this:
https://qt-project.org/doc/qt-4.7/qtwebkit-bridge.html -
Is this suitable for jni?!
-
Hi, I guess that depends how do you want to send the message from java to c++?
I don't know if there is an easy way, all I can think of is calling a native function from java through JNI, but you can't just access other apps in Android so you may have to use an intent or something. Then again I don't think you have android intents in the android NDK, for whatever reason :/Might be easier if you can create the activity from the Qt app and call the java function from there or something, Qt has some helper classes like "QAndroidJniObject":http://qt-project.org/doc/qt-5/qandroidjniobject.html and "QAndroidJniEnvironment":http://qt-project.org/doc/qt-5/qandroidjnienvironment.html you might want to take a look at those.
-
You could probably send an intent from your activity to your Qt applications QtActivity. The Android docs will tell you how.
To process the intent you can create a custom class that extends QtActivity. From that class you can then call native code. The QtHangman example does all that:
http://blog.qt.digia.com/blog/2013/12/12/implementing-in-app-purchase-on-android/
You can find a link to the sources in the post, too.
-
I don't know...anyway I have given up with this solution.
Thanks to all