Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. How do I access Android activity in QT6.2?

How do I access Android activity in QT6.2?

Scheduled Pinned Locked Moved Solved Qt 6
3 Posts 2 Posters 2.8k Views
  • 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.
  • D Offline
    D Offline
    Dmitriano
    wrote on last edited by Dmitriano
    #1

    I tried (see https://doc-snapshots.qt.io/qt6-dev/qtandroidprivate.html)

    in pro:

    QT += core 
    

    in C++:

    #include <QtAndroid>
    

    but got:

    fatal error: 'QtAndroid' file not found
    

    previously in QT5.15 I used:

    QAndroidJniObject a_obj = QtAndroid::androidActivity();
    

    what should I replace it with in QT6?

    I tired to find the headers in the repository I built QT6.2 from:

    find . -iname "QtAndroid*.h"
    

    but with no success.

    raven-worxR 1 Reply Last reply
    0
    • D Dmitriano

      I tried (see https://doc-snapshots.qt.io/qt6-dev/qtandroidprivate.html)

      in pro:

      QT += core 
      

      in C++:

      #include <QtAndroid>
      

      but got:

      fatal error: 'QtAndroid' file not found
      

      previously in QT5.15 I used:

      QAndroidJniObject a_obj = QtAndroid::androidActivity();
      

      what should I replace it with in QT6?

      I tired to find the headers in the repository I built QT6.2 from:

      find . -iname "QtAndroid*.h"
      

      but with no success.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Dmitriano
      it has been moved to QtCore: https://doc-snapshots.qt.io/qt6-6.2/qnativeinterface-qandroidapplication.html
      Additionally you can link to QtCorePrivate and include <QtCore/private/qandroidextras_p.h>

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      D 1 Reply Last reply
      1
      • raven-worxR raven-worx

        @Dmitriano
        it has been moved to QtCore: https://doc-snapshots.qt.io/qt6-6.2/qnativeinterface-qandroidapplication.html
        Additionally you can link to QtCorePrivate and include <QtCore/private/qandroidextras_p.h>

        D Offline
        D Offline
        Dmitriano
        wrote on last edited by
        #3

        @raven-worx said in How do I access Android activity in QT6.2?:

        it has been moved to QtCore: https://doc-snapshots.qt.io/qt6-6.2/qnativeinterface-qandroidapplication.html

        there is a typo in the docs: context() returns jobject but not int.

        1 Reply Last reply
        0
        • R Recursion referenced this topic on

        • Login

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