File Operations in Smartface are managed under SMF.IO namespace. Basically, there is a File object which manages File & Directory operations and a FileStream object for reading-writing file content. Predefined directories are defined (details will be shared below), and some other helper content is created.
The File object is a reference object which points a file location in the operation system. When the object is created, it requires a path with a constructor. It is not important to have the file or directory to exist in that location, which can be created later.
The contents of the File object can be found on API Docs.
Below are the sample declarations of the File object:
The example below explains how the content is read and written:
The members of SMF.IO are listed in API Docs. Here are the list of the members and their purposes:
- applicationDataDirectory – Static File object instance for Path to the data directory of an application.
- applicationCacheDirectory – Static File object instance for Path to the internal cache directory of an application.
- applicationResources – Static File object instance for Path to the resource directory of an application.
- applicationTemporaryData – Static File object instance for Path for the temporary directory of an application.
We can share files, images and texts on the Smartface as below:
This method is the listing the external storages. As iOS does not support external storages, this will work for Android only.
Android will list the plugged-in (connected & online) external storages in the following order if they are available:
External SD card