Java library for https://github.com/teco-kit/explorer. Can be used to upload datasets as whole or incrementally. Written in Java. Can be used in Android projects.
The library can be found in Maven Central.
- Add mavenCentral to you repositories if it is not alreaedy there
repositories {
mavenCentral()
}
- Import the library
dependencies {
implementation 'edu.teco.explorer:ExplorerJava:${VERSION}
}
Include the library as a dependency in pom.xml
<dependencies>
<dependency>
<groupId>edu.teco.explorer</groupId>
<artifactId>ExplorerJava</artifactId>
<version>${VERSION}</version>
</dependency>
</dependencies>
Recorder recorder = new Recorder("explorerBackendUrl", "deviceApiKey");
boolean res = recorder.sendDataset(JSONObject); // Dataset as JSONObject
Recorder recorder = new Recorder("explorerBackendUrl", "deviceApiKey");
try {
IncrementalRecorder incRecorder = recorder.getIncrementalDataset("datasetName", false); // false to use custom timestamps
// time should be a unix timestamp
incRecorder.addDataPoint(1595506316000L, "accX", 123);
// This will throw an UnsupportedOperationException because no timestamp was provided
incRecorder.addDataPoint("accX", 124);
// Tells the libarary that all data has been recorded
// Uploads all remaining datapoints to the server
incRecorder.onComplete();
}
} catch (Exception e) {
e.printStackTrace();
}
Recorder recorder = new Recorder("explorerBackendUrl", "deviceApiKey");
try {
IncrementalRecorder incRecorder = recorder.getIncrementalDataset("datasetName", true); // true to use deviceTime
incRecorder.addDataPoint("accX", 123);
// This will throw an UnsupportedOperationException because a timestamp was provided
incRecorder.addDataPoint(1595506316000L, "accX", 123);
// Wait until all values have been send
incRecorder.onComplete();
} catch (Exception e) {
e.printStackTrace();
}