Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[CLOSED] is it possible to send notification from java to Qt?
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?
McLion last edited by
Are you looking for something like this:
Is this suitable for jni?!
Xander84 last edited by
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.
ltr6 last edited by
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:
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