/Bophelo-Haeso-Open

Open Source project that implements an API and an app that is aimed at Community Health Workers in rural communities

Primary LanguageJava

Bophelo-Haeso-Open

Haeso API Technical Documentation

Setting up the API

The API is currently fully implemented in its own package called HaesoAPI.

To use the API:

  1. Download the package from https://github.com/Shaaheen/Bophelo-Haeso-Open/archive/master.zip
  2. Place the Haeso API folder in your desired Project folder
  3. Import classes from the Haeso API eg. “import capstone.bophelohaesoopen.HaesoAPI”

Initializing API

Before calling on the API functionality, some optional configurations can be set for the 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