Commit af20ed6e authored by Volker Krause's avatar Volker Krause
Browse files

Add basic support for opening files via Android Intents

This works for file URLs, but this doesn't resolve content URLs yet that
e.g. the default file manager seems to use for standard locations.
parent 8f1318d7
......@@ -27,6 +27,11 @@
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QtAndroid>
#include <QAndroidJniObject>
#include <QCommandLineParser>
#include <QGuiApplication>
#include <QIcon>
......@@ -69,5 +74,20 @@ int main(int argc, char **argv)
for (const auto &file : parser.positionalArguments())
// handle opened files
const auto activity = QtAndroid::androidActivity();
if (activity.isValid()) {
const auto intent = activity.callObjectMethod("getIntent", "()Landroid/content/Intent;");
if (intent.isValid()) {
const auto data = intent.callObjectMethod("getDataString", "()Ljava/lang/String;");
if (data.isValid()) {
// TODO handle content:// urls
return app.exec();
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment