Android Filing System?

Peter Reid preid at reidit.co.uk
Fri Oct 27 07:17:31 EDT 2017


Please can someone explain the Android filing system as seen by LC 9.  I'm developing an app that loads some files & folders with the app initially, but then changes some or all of this data.  In addition, the app will read and write files & folders to the SD card plugged into the Android tablet.

From the LC dictionary, I have the following:
---------
An Android application is installed on the device as a ZIP package.
This means that any assets that are included are not available as separate files in the device's native file system. In order to manage this, LiveCode "virtualizes" the asset files you include, allowing read-only access with all the standard LiveCode file and folder handling commands and functions. To access the assets you have included with your application, use file names relative to specialFolderPath("engine").

The following folderIdentifier values are supported:

	• "documents": The folder where application-specific data can be placed (typically valuable)
	• "cache": The folder where transient application-specific data can be placed (typically not valuable)
	• "temporary": Same as "cache"
	• "engine": The (virtual) folder containing the application's LiveCode engine and other resources that were copied into the application at build time
	• "resources": Same as "engine".
	• "external documents": The folder on the primary shared/external storage device where application-specific data can be placed
	• "external cache": The folder on the primary shared/external storage device where transient application-specific data can be placed
	• "external temporary": same as "external cache"

Note: If using any external folderIdentifier values, ensure you have the 'Write External Storage' permission checked in the application standalone settings
---------

The above implies that access to the internal filing system is read-only, even for the "documents" special folder and that the only filing system that I can write to is the external one on the SD card.  Is this correct?

I'm trying to carry out the following sequence of actions:

1. A collection of folders & files are setup in the internal filing system as part of the app ("documents" say).

2. The user can use the default folders & files created above, or they can choose a different set of folders & files to be copied from the SD card into the internal filing system, replacing some or all of the initial default set.

3. During general use of the app, the user will record their voice several times.  These recordings should be stored on both the internal and SD card filing systems.

What I'm finding is that my file and folder paths are not reliable and that most attempts to write anywhere fail due to being read-only.

Any help with this please?

Peter
--
Peter Reid
Loughborough, UK





More information about the use-livecode mailing list