A basic mobile app for your SCiO Sensor will have the following workflow:
Register your app:
Create and register your app in SCiO Lab to receive an Application ID (Key) and Application Secret.
Implement Login functionality, get access token:
Use the SCiO login activity to allow the end user to login to the SCiO Cloud.
Connect to the SCiO sensor:
Use the Bluetooth Low Energy API to ensure that your Bluetooth settings are enabled in your Android device. Search and connect to the SCiO Sensor.
Note:
- A SCiO Sensor can only connect to one mobile device at a time.
- Code examples are based on the latest version of the Android BLE API. For backward compatibility use an earlier version of the API.
Initiate a SCiO scan:
Call the ScioDevice.scan
method to scan a sample. The results are returned in a ScioReading object. A scan returns one of the following results:
- onSuccess: When the scan is successful, the scan returns a ScioReading object with the sample details.
- onNeedCalibrate: Indicates that the SCiO sensor should be calibrated. The scan failed and no reading is returned.
- onError: Indicates that the scan failed.
- onTimeout: Indicates that there was a timeout.
Send the SCiO reading to the Cloud for analysis:
Send the sample reading to the cloud together with a Model ID. The sample is compared to the model and the results returned to the mobile device. The model is defined in the ScioLab app and holds definitions for various items such as cheese or medications.