Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
"Native calls" to WinRT equivalent to QAndroidJniObject ?
jea1768 last edited by
I'm trying to port my Android Apps to Windows Phone 8.1 but is there a way/method to
do "native calls" like we can do with QAndroid to Java with WinRT ?
Where are the examples/templates ? Should be more direct as it is C++ to C++, so direct lib calls, I suppose but how to start working with it ?
I need to access the battery level, networks states & status, etc.
metzgore last edited by
Have you found an answer to that yet? I'm also looking for a possibility to call native code from Qt on Windows Phone.
jseeQt last edited by
There are no examples because it' simply C++ code you have to write.
For the battery level look at this class:
Windows Store/Phone apps usually use C++/CX, an extension to C++. Probably you've seen something like:
SomeClass^ object = ref new SomeClass();
That's C++/CX code, it have a little different syntax than plain C++, but every example in the web is written in C++/CX.
So, where you now have your JNI-calls, put in C++/CX for WinRT.
But: Qt doesn't enable the C++/CX extension by default and QtCreator have no support for C++/CX.
I prefer to work with Visual Studio in this case. So, click in Visual Studio on your project --> Properties --> C++ --> General --> Consume Windows Runtime Extension --> Yes (/ZW). This will turn on the C++/CX extension for your code.
Feel free to ask further questions!