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. [solved] Using native Android APIs from Qt
Forum Updated to NodeBB v4.3 + New Features

[solved] Using native Android APIs from Qt

Scheduled Pinned Locked Moved Mobile and Embedded
6 Posts 2 Posters 3.0k 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.
  • A Offline
    A Offline
    alexey.petrenko
    wrote on last edited by
    #1

    I am considering using Qt for my next Android project. This project will involve a lot of work with hardware device functions, e.g. I'll need direct access to Wi-Fi adapter (http://developer.android.com/reference/android/net/wifi/package-summary.html)

    Is it possible to use native Android API functions in Qt project even if they're not wrapped in Qt framework? Is it possible to call native Android code from Qt C++?
    I mean, is it true that everything that I could do with native Android tools (Java or JNI) I can do with Qt?
    Where do I learn about this?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You can call Android native API through e.g. QAndroidJniObject. The QtAndroidExtras module is the one you will be interested in.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alexey.petrenko
        wrote on last edited by
        #3

        Thanks, I will look at it!

        The most important thing I am concerned about is this question:
        is it true that everything that I could do with native Android tools (Java or JNI) I can do with Qt?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          There's no 1 to 1 wrapping of absolutely all functionalities provided by Android. That's why there's the module I indicated. However if you encounter a use case where you need to write some Java code, you can use it in your Qt application. Take for example "this":http://doc.qt.io/qt-5/qtandroidextras-notification-example.html

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • A Offline
            A Offline
            alexey.petrenko
            wrote on last edited by
            #5

            [quote author="SGaist" date="1422834149"]There's no 1 to 1 wrapping of absolutely all functionalities provided by Android. That's why there's the module I indicated. However if you encounter a use case where you need to write some Java code, you can use it in your Qt application. Take for example "this":http://doc.qt.io/qt-5/qtandroidextras-notification-example.html[/quote]

            Ok, got it :)
            So if there's a case where I need to use something really custom, I just code it in Java and plug into my Qt app. This should work, thanks!

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Exactly !

              You're welcome !

              If your question is answered, please update the thread title prepending [solved] so other forum users may know that's all good :)

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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