Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QAndroidBinder vs AIDL



  • I need to create communication between android-java service and qt ui application. My current approach is to build with Qt app internal java service extending QtService, then connect both java services using binder/aidl. Next step is to create communication inside Qt App, between client.cpp and QtService. Easiest approach is to make RPC through JNI using <QAndroidJni...>, it looks nice and works, but i need to perform over 60 procedure calls every second on device which is not that fast to deal with this for sure (cuz Jni is slow).

    So Iam trying to alsor use .aidl interface between client.cpp and Qt app internal Java service (MyService extends QtService). I have aidl-cpp generated headers with MyInterface.h, BpMyInterface.h and BnMyInterface.h. In case of communication between two java services, we shall save binder reference as our <Interface> type in onServiceConnected method. And i want to do so in client.cpp, but BpMyInterface object is taking as argument BpMyInterface(const ::android::sp<::android::IBinder>& _aidl_impl) and i've got only QAndroidBinder from onServiceConnected(const QString &name, const QAndroidBinder &serviceBinder).

    Any ideas how to get IBinder from java service, or connect them using another method?

    I also need to write, that i had to add some headers (not exposed by NDK) to my QtApp (like binder/Binder.h).
    qt(1).png


Log in to reply