We wanted the Android application to be compatible with as many Android devices as possible, so we ensured we only used features that were compatible with all devices running Android 2.3.3 or higher. This corresponds to 98.5% of Android devices. We also used Bluetooth 2.0 over BLE to ensure that maximum number of devices are supported. Using BLE would have reduced the percentage of supported devices (Based on statistics at the time of writing. Latest statistics can be found here).
Android Studio IDE was used to develop the application using the target SDK as Android 5.0 (SDK 21) but using only APIs that are supported down till Android 2.3.3 (SDK 10). The app was build incrementally by adding modules, starting from a basic skeleton for the overall app and then developing individual modules. The modules were refined as the app was built.
The overall architecture of the app consists of following modules with some overlap between modules:
- The driver routine: This consists driver routines for the app so that app can initialize and move ahead to appropriate parts of the app based on user inputs.
- The camera activities: To capture images of the objects being examined using the phone’s camera and save them onto local storage.
- Bluetooth activities: To pair with the spectrometer over Bluetooth and to trigger the reading of data from the sensor. Once the data is received, it is cleaned, visualized and stored.
- Visualization: To visualize the data received from Bluetooth and present it appropriately in the form of a plot so the spectrum can be observed.
- Database and data export: To store the spectrometer readings, images and to allow the user to exported the stored data to an excel file for further analysis.