diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-09-25 12:22:40 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-09-25 12:40:10 +0200 |
commit | 700766026e4da404e40410228dcc6877d9c5c945 (patch) | |
tree | b22e0313a4c2ceb2c1fba90a6dd059d6a0b343e1 | |
parent | eacc209359fad5097faac8dc4f45c58511eb09c7 (diff) |
Fix build of geojson_viewer example on Android
Don't use the private qandroidextras header.
Not using the new permission API yet, just fixing the build for now. The
example builds and launches correctly on the emulator without asking
for permisssions anyway.
Pick-to: 6.6
Fixes: QTBUG-117404
Change-Id: I2f67bd9dfe23e3033db6e18d79d1f05f5be05b8b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r-- | examples/location/geojson_viewer/main.cpp | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/examples/location/geojson_viewer/main.cpp b/examples/location/geojson_viewer/main.cpp index 19ae399c..4df196a3 100644 --- a/examples/location/geojson_viewer/main.cpp +++ b/examples/location/geojson_viewer/main.cpp @@ -4,49 +4,14 @@ #include <QGuiApplication> #include <QQmlApplicationEngine> -#include <QDebug> -#include <QFile> -#include <QVariantMap> #include <QQmlContext> -#include <QGeoCircle> -#include <QGeoPath> -#include <QGeoPolygon> -#include <QtCore/qobjectdefs.h> -#ifdef Q_OS_ANDROID -# include <QtCore/private/qandroidextras_p.h> -#endif - using namespace Qt::StringLiterals; - -#ifdef Q_OS_ANDROID -// Request permissions because we're using QStandardPaths::writableLocation() -bool requestStoragePermissions() -{ - const QString permission = "android.permission.WRITE_EXTERNAL_STORAGE"_L1; - auto checkFuture = QtAndroidPrivate::checkPermission(permission); - if (checkFuture.result() == QtAndroidPrivate::Denied) { - auto requestFuture = QtAndroidPrivate::requestPermission(permission); - if (requestFuture.result() != QtAndroidPrivate::Authorized) { - qWarning() << "Couldn't get permission: " << permission; - return false; - } - } - - return true; -} -#endif - int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); -#ifdef Q_OS_ANDROID - if (!requestStoragePermissions()) - return -1; -#endif - QQmlApplicationEngine engine; engine.rootContext()->setContextProperty("dataPath", QUrl(QStringLiteral("file://") + qPrintable(QT_STRINGIFY(SRC_PATH)) |