Reading content url on android QtQuick 5.15
-
-
@ekkescorner I've read them both, the first one doesn't mention anything about content url's (thatI see anyway) and the latter has the same suggestion from the moderator
-
@ekkescorner It seems to me the answer is "you don't"
-
@ekkescorner It seems to me the answer is "you don't"
@cmorgan I haven't tried native Android QFileDialog and Qt 5.15 yet - have to finish customer projects on 5.13.2 before
But I have used a content url in my share example https://github.com/ekke/ekkesSHAREexample/blob/master/android/src/org/ekkescorner/utils/QSharePathResolver.java -
Hi,
I am trying to use your nice QSharePathResolver class, but this time to resolve a directory name sent by QFileDialog::openExistingDirectory (native mode).
This returns something in the form "content://com.android.externalstorage.documents/tree/home%3A" (just selected Documents directory on the phone).
QSharePathResolver just throw an exception (catched) on that. How can I convert this to just a QDirectory?
Running on qt 5.15.2, tested on Android 10 and 11
Thanks for any clue,
Philippe -
Hi,
I am trying to use your nice QSharePathResolver class, but this time to resolve a directory name sent by QFileDialog::openExistingDirectory (native mode).
This returns something in the form "content://com.android.externalstorage.documents/tree/home%3A" (just selected Documents directory on the phone).
QSharePathResolver just throw an exception (catched) on that. How can I convert this to just a QDirectory?
Running on qt 5.15.2, tested on Android 10 and 11
Thanks for any clue,
Philippe@maitai_vw is on my todo list ;-)
just too much work on customer projects (mobile apps Android, iOS) -
@maitai_vw is on my todo list ;-)
just too much work on customer projects (mobile apps Android, iOS)@ekkescorner HI
I'm trying to use your example to get filePath from android content:/..
I'm using QSharePathResolver but since I don't know Java at all ;) I have trouble calling this method, can you give me some hint ?
Here is Qt code:QString PostManager::getFilePath(QUrl url) { #ifdef Q_OS_ANDROID QAndroidJniObject jsPath = QAndroidJniObject::fromString(url.toLocalFile()); QAndroidJniObject uri = QAndroidJniObject::callStaticObjectMethod("android/net/Uri","parse","(Ljava/lang/String;)Landroid/net/Uri;", jsPath.object()); QString filename = QAndroidJniObject::callStaticObjectMethod( "org/ekkescorner/utils/QSharePathResolver", "getRealPathFromURI", "(Landroid/content/Context;Landroid/net/Uri)Ljava/lang/String;", QtAndroid::androidContext().object(),uri.object<jobject>()).toString();
And here is debug from phone with the error:
W System.err: java.lang.NoSuchMethodError: no static method "Lorg/ekkescorner/utils/QSharePathResolver;.getRealPathFromURI(Landroid/content/Context;Landroid/net/Uri)Ljava/lang/String;" W System.err: at org.qtproject.qt5.android.QtNative.startQtApplication(Native Method) W System.err: at org.qtproject.qt5.android.QtNative$7.run(QtNative.java:620) W System.err: at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61) W System.err: at java.lang.Thread.run(Thread.java:923)
Basically I need "file://..." to pass as videoSource for MediaPlayer, it can't read "content:/..."
Best Regards
Marek -
@Marek sorry - cannot help immediately. ... working on 5 new highly complex mobile business apps (some with Bluetooth SPP Printer, some with BLE Scanner, one with Beacons) last months
hopefully soon more time for community
now because of Apple requiring XCode 12 I finally have to update my tooling...
next week I'll move from Qt 5.13.2 to 5.15 and from macOS Mojave to Catalina, XCode from 11 to 12, Android NDK, SDK, ...
will take some days until all projects running again ;-)
Then I'll have to take a look at using native Android QFileDialog and probably rewrite my Pathresolver
will let you know ...