Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    "Native calls" to WinRT equivalent to QAndroidJniObject ?

    Mobile and Embedded
    3
    3
    1097
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      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.

      1 Reply Last reply Reply Quote 1
      • M
        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.

        1 Reply Last reply Reply Quote 0
        • J
          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:
          https://msdn.microsoft.com/en-us/library/windows.phone.devices.power.battery.aspx

          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!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post