How do I access Android activity in QT6.2?
Solved
Qt 6
-
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.
-
@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>
-
@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()
returnsjobject
but notint
. -