Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. "Native calls" to WinRT equivalent to QAndroidJniObject ?
Forum Updated to NodeBB v4.3 + New Features

"Native calls" to WinRT equivalent to QAndroidJniObject ?

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 3 Posters 1.3k Views 1 Watching
  • 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 Offline
    J Offline
    jea1768
    wrote on last edited by
    #1

    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
    1
    • M Offline
      M Offline
      metzgore
      wrote on last edited by
      #2

      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
      0
      • J Offline
        J Offline
        jseeQt
        wrote on last edited by
        #3

        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
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved