Edit: FileProvider is included as an internal library now.
After investigating several issues with the current FileProvider code that you can find in the forum, I decided to make some improvements and implement it in a class.
Starting from Android 7 (API 24) you cannot directly share file uris with other applications. You need to use FileProvider.
The FileProvider class should work on all Android versions (4+).
Instructions:
1. Add a reference to FileProvider library.
2. Add to the manifest editor:
files-path = File.DirInternal
Current version: 1.00
After investigating several issues with the current FileProvider code that you can find in the forum, I decided to make some improvements and implement it in a class.
Starting from Android 7 (API 24) you cannot directly share file uris with other applications. You need to use FileProvider.
The FileProvider class should work on all Android versions (4+).
Instructions:
1. Add a reference to FileProvider library.
2. Add to the manifest editor:
B4X:
AddManifestText(<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
)
AddApplicationText(
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="$PACKAGE$.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
)
CreateResource(xml, provider_paths,
<files-path name="name" path="shared" />
)
Current version: 1.00
Attachments
Last edited: