From 5d8801056e90e6789e0fe211b1a8c87eaf944f8e Mon Sep 17 00:00:00 2001 From: FalsinSoft Date: Thu, 7 Dec 2023 21:31:57 +0100 Subject: [PATCH] Adapted code to the latest changes of Qt 6.6 --- Documentation/index.html | 6 ++-- .../qtandroidtools/AndroidSharing.java | 4 +-- .../android/AndroidManifest.xml | 28 ++++++++++--------- QtAndroidToolsDemo/android/build.gradle | 19 +++++++------ QtAndroidToolsDemo/android/gradle.properties | 4 +-- .../android/res/xml/qtprovider_paths.xml | 4 +++ .../android/res/xml/sharedfilepaths.xml | 3 -- 7 files changed, 36 insertions(+), 32 deletions(-) create mode 100644 QtAndroidToolsDemo/android/res/xml/qtprovider_paths.xml delete mode 100644 QtAndroidToolsDemo/android/res/xml/sharedfilepaths.xml diff --git a/Documentation/index.html b/Documentation/index.html index 378e9e5..f9a67ea 100644 --- a/Documentation/index.html +++ b/Documentation/index.html @@ -554,12 +554,12 @@

Sharing

<category android:name="android.intent.category.OPENABLE"/> <data android:mimeType="image/*"/> </intent-filter> -

Regarding the file sharing provider the code is the following:

+

Regarding the file sharing provider make sure the following tag is present:

<provider android:name="androidx.core.content.FileProvider"
-          android:authorities="${applicationId}.qtandroidtoolsfileprovider"
+          android:authorities="${applicationId}.qtprovider"
           android:grantUriPermissions="true"
           android:exported="false">
-    <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/sharedfilepaths"/>
+    <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/qtprovider_paths"/>
 </provider>

You can name the resource as you prefer but don't change the authorities name cause the tool refer to this label (qtandroidtoolsfileprovider) for configure the correct resource.

For share simple data from your app to other apps the following function are available:

diff --git a/QtAndroidTools/src/com/falsinsoft/qtandroidtools/AndroidSharing.java b/QtAndroidTools/src/com/falsinsoft/qtandroidtools/AndroidSharing.java index dc8daf7..7bc527e 100644 --- a/QtAndroidTools/src/com/falsinsoft/qtandroidtools/AndroidSharing.java +++ b/QtAndroidTools/src/com/falsinsoft/qtandroidtools/AndroidSharing.java @@ -143,7 +143,7 @@ public boolean shareBinaryData(String mimeType, String dataFilePath) try { fileUri = FileProvider.getUriForFile(mActivityInstance, - packageName + ".qtandroidtoolsfileprovider", + packageName + ".qtprovider", new File(dataFilePath) ); } @@ -174,7 +174,7 @@ public boolean shareFile(boolean fileAvailable, String mimeType, String filePath try { fileUri = FileProvider.getUriForFile(mActivityInstance, - packageName + ".qtandroidtoolsfileprovider", + packageName + ".qtprovider", new File(filePath) ); } diff --git a/QtAndroidToolsDemo/android/AndroidManifest.xml b/QtAndroidToolsDemo/android/AndroidManifest.xml index 0e8618f..327aa44 100644 --- a/QtAndroidToolsDemo/android/AndroidManifest.xml +++ b/QtAndroidToolsDemo/android/AndroidManifest.xml @@ -3,8 +3,17 @@ - - + + + + + + + + + + + @@ -25,26 +34,19 @@ - - - - - - - - - - + + + + - diff --git a/QtAndroidToolsDemo/android/build.gradle b/QtAndroidToolsDemo/android/build.gradle index e2764fd..f030de3 100644 --- a/QtAndroidToolsDemo/android/build.gradle +++ b/QtAndroidToolsDemo/android/build.gradle @@ -19,20 +19,21 @@ apply plugin: 'com.android.application' dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation 'com.google.android.gms:play-services-ads:21.+' - implementation 'com.google.android.gms:play-services-auth:18.+' + implementation 'com.google.android.gms:play-services-auth:20.+' + implementation 'com.google.android.ump:user-messaging-platform:2.1.0' + implementation 'androidx.annotation:annotation:1.7.0' + implementation 'androidx.core:core:1.10.1' + implementation 'com.google.guava:guava:24.1-jre' + implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' implementation 'com.google.http-client:google-http-client-gson:1.26.0' implementation('com.google.api-client:google-api-client-android:1.26.0') { exclude group: 'org.apache.httpcomponents' + exclude module: 'guava-jdk5' } - implementation ('com.google.apis:google-api-services-drive:v3-rev173-1.25.0') { + implementation('com.google.apis:google-api-services-drive:v3-rev136-1.25.0') { exclude group: 'org.apache.httpcomponents' + exclude module: 'guava-jdk5' } - implementation 'com.google.android.ump:user-messaging-platform:1.0.0' - implementation 'androidx.annotation:annotation:1.1.0' - implementation 'com.google.guava:guava:28.2-android' - implementation 'androidx.activity:activity:1.5.1' - implementation 'androidx.fragment:fragment:1.5.5' - implementation 'androidx.appcompat:appcompat:1.4.2' } android { @@ -49,7 +50,7 @@ android { * Changing them manually might break the compilation! *******************************************************/ - compileSdkVersion androidCompileSdkVersion.toInteger() + compileSdkVersion androidCompileSdkVersion buildToolsVersion androidBuildToolsVersion ndkVersion androidNdkVersion diff --git a/QtAndroidToolsDemo/android/gradle.properties b/QtAndroidToolsDemo/android/gradle.properties index ff5389f..199ab06 100644 --- a/QtAndroidToolsDemo/android/gradle.properties +++ b/QtAndroidToolsDemo/android/gradle.properties @@ -1,3 +1,3 @@ -org.gradle.jvmargs=-Xmx2048m +org.gradle.jvmargs=-Xmx2500m -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +org.gradle.parallel=true android.useAndroidX=true -android.enableJetifier=true diff --git a/QtAndroidToolsDemo/android/res/xml/qtprovider_paths.xml b/QtAndroidToolsDemo/android/res/xml/qtprovider_paths.xml new file mode 100644 index 0000000..ae5b4b6 --- /dev/null +++ b/QtAndroidToolsDemo/android/res/xml/qtprovider_paths.xml @@ -0,0 +1,4 @@ + + + + diff --git a/QtAndroidToolsDemo/android/res/xml/sharedfilepaths.xml b/QtAndroidToolsDemo/android/res/xml/sharedfilepaths.xml deleted file mode 100644 index 210eb90..0000000 --- a/QtAndroidToolsDemo/android/res/xml/sharedfilepaths.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file