Just finished a few updates to some Fuse Open modules and thought I’d briefly discuss the changes and usage.
So Android introduced the FileProvider(subclass of ContentProvider) which essentially deals with access control to files being shared with an app via a predefined xml file. This affects Uri’s with file:// which need to be updated to use content://. This can be done by using FileProvider.getUriForFile. Here’s a quick summary I found if ya wanna briefly read more.
The example app is about 117 lines and has some nice buttons for you to press to test everything, just export it to your device with:
fuse build -t=android --run
I left an .unoconfig file in the example which just locally points to the latest fuselibs, you will need to update this to point to your cloned repo, then just override the Fuse.Camera, Fuse.ImageTools and Fuse.Share in your fuselibs from my PRs or Fuse.Camera and Fuse.Share branches.
You may need to use the following command to make sure your project is using the fuselibs you’re pointing to:
The current version of the Camera Module uses file:// when it takes a photo, it stores it temporarily in external cache which it needed access to for API 23+(Marshmallow).
Apart from this, the camera would have Out Of Memory(OOM) errors on some android phone models after taking a photo because the photo exists in memory and when rotating it afterwards, to adjust for the orientation it was taken with, another copy is created in memory, some models don’t have enough memory at this point, so they throw an OOM fit.
The strategy I went with to continue with the expected user experience, was to resize the image to fit the amount of available app memory before rotating. It was either that or not doing anything to the image after the OOM, thereby leaving the photos rotation uncorrected.
Ok, so the Share Module also suffered from the lack of file access control for API 23+, so for its default folders to share, I included the following paths:
<cache-path name="cache" path="." />
<files-path name="files" path="." />
<external-cache-path name="external_cache_images" path="images" />
<cache-path name="cache_images" path="images" />
The images path is needed when sharing the photo taken from the Camera module.
So you’re probably gonna need to override these paths when creating your fuse app to allow sharing from custom named folders in your app, you can do this by creating 2 files in your project directory…
android_share.uxl: this overrides the default share list of paths with your list of paths
android_share_paths.xml: this has the list of paths you want to allow other apps access to when sharing a file.
Here’s nice table with a summary of the XML tags that I’ve borrowed from codepath:
Happy fusing! 🖖