Hello everyone!
I've had a problem for several days with file sharing using distriqt's share extension.
I save csv files in applicationStorageDirectory. It works and I can load them in my applis.
I'm trying to set up a share for these files, but it's not working... and I can't figure out where the error is coming from!
Here's my code:
var f = File.applicationStorageDirectory.resolvePath("FileName");
trace("f.nativePath : " + f.nativePath);
trace("Share Supported :" + Share.isSupported);
trace("Share Version: " + Share.service.version);
if (f.exists) {
var options: ShareOptions = new ShareOptions();
options.title = "Partager avec ...";
Share.service.addEventListener(ShareEvent.COMPLETE, share_shareHandler);
Share.service.addEventListener(ShareEvent.CANCELLED, share_shareHandler);
Share.service.addEventListener(ShareEvent.FAILED, share_shareHandler);
Share.service.addEventListener(ShareEvent.CLOSED, share_shareHandler);
Share.service.shareFile(f.nativePath, "FileName", "text/csv");
function share_shareHandler(event: ShareEvent): void {
trace(event.type + "::" + event.activityType + "::" + event.error;
}
} else {
trace("File doesn't exist")
}
f.nativePath is ok
Share supported is true
Share version is 7.6.0
..and share failed : Could not access the file.Check WRITE-EXTERBAL_STORAGE permission and FileProvider.
I think i don't need permission for readind or writinq in ApplicationStorage Directory, and FileProvider is good ...
In the manifest, i have :
<android>
<manifestAdditions><![CDATA[ <manifest android:installLocation="auto">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application>
<activity android:name="com.distriqt.core.auth.AuthorisationActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:exported="false" />
<activity
android:name="com.distriqt.extension.scanner.zbar.ZBarScannerActivity"
android:screenOrientation="portrait"
/>
<provider
android:name="com.distriqt.extension.share.content.ShareFileProvider"
android:authorities="com.multimaths.scanscores.sharefileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/distriqt_share_paths" />
</provider>
</application>
</manifest>]]>
</manifestAdditions>
</android>
FileProvider is declared at distriqt with the right name, and the corresponding extensions... I really don't understand what's wrong!
If anyone can enlighten me, it would be incredible!