Ares-Defence-Labs/KmpEssentials

[Android] "shareFileWithAnyApp" shares text instead of file.

Closed this issue · 2 comments

Hello.

I am using version 1.0.5

Here is example:

val filePath = KmpFileSystem.getTempCacheDirectory() + "/" + fileName + ".csv"

...logic of data filling...

KmpShare.shareFileWithAnyApp(filePath = filePath, optionalTitle = "Share")

Result will filePath string instead of file.

@TheArchitect123 seems like shareTextWithAnyApp and shareFileWithAnyApp have identical body code.

Hi,

Please download the latest version (v1.1.7) and try again.

implementation("io.github.thearchitect123:kmpEssentials:1.1.7")

You will need to configure the FileProvider according to the documentation here, and scope the fileprovider (for file read access) according to where the files are currently being stored.

I gave an example in the documentation.
https://thearchitect123.github.io/ArtifactsDocProduction/develop/kotlin/multiplatform/kmpessentials/modules/shareData#android-setup

Thanks,