Bophelo-Haeso-Open
Haeso API Technical Documentation
The API is currently fully implemented in its own package called HaesoAPI. Setting up the API
To use the API:
- Download the package from https://github.com/Shaaheen/Bophelo-Haeso-Open/archive/master.zip
- Place the Haeso API folder in your desired Project folder
- Import classes from the Haeso API eg. “import capstone.bophelohaesoopen.HaesoAPI”
Before calling on the API functionality, some optional configurations can be set for the API. Initializing API
App Folder configuration
The folder names can be specified so the API knows what folders to save files in.
To do any file management, an instance of FileUtils must be created:
FileUtils fileUtils = new FileUtils(this);
Thereafter, to set the app folder names, call the setFolderNames method to set the static folder names in the API:
fileUtils.setFolderNames(AppName, VideosFolder, RecordingsFolder, ImageFolder);
Set the app identifier prefix
The API distinguishes related app files with a specified prefix. This prefix must be set before use of the API or else all media files on the device would be recognized as App files.
To set the identifier prefix:
Media.setIdentifierPrefix(identifierPrefix);
Getting specific media files from device
To retrieve the files of app specific media files, the FileUtils class must be used. Use this method with the app prefix and the extension of the type of file you want to retrieve.
ArrayList getMediaCollectionFromStorage(String prefix, String extension)
Eg:
videoList = (ArrayList