An Android client library for the Distributed Aggregation Protocol.
The following versions of the DAP protocol are supported by different branches and releases.
| Package version | Git branch | Protocol version | Conformant? | Status |
|---|---|---|---|---|
| 0.1.0 | release/0.1 | draft-ietf-ppm-dap-07 | Yes | Unmaintained as of June 24, 2024 |
| 0.2.0 | main | draft-ietf-ppm-dap-09 | Yes | Supported |
Ensure that Maven Central is in the list of repositories from which dependencies are resolved. Add the library to your project as follows.
// build.gradle
dependencies {
implementation 'org.divviup.android:divviup-android:0.1.0'
}// build.gradle.kts
dependencies {
implementation("org.divviup.android:divviup-android:0.1.0")
}Construct a Client from your DAP task's parameters, and use it to send report as follows.
(Note that this should be done off the main thread)
importandroid.util.Log;
importorg.divviup.android.Client;
importorg.divviup.android.TaskId;
importjava.net.URI;
publicclassMyRunnableimplementsRunnable {
publicvoidrun() {
try {
URIleaderEndpoint = newURI("https://<your leader here>/");
URIhelperEndpoint = newURI("https://<your helper here>/");
TaskIdtaskId = TaskId.parse("<your DAP TaskId here>");
longtimePrecisionSeconds = <yourtimeprecisionhere>;
Client<Boolean> client = Client.createPrio3Count(context, leaderEndpoint, helperEndpoint, taskId, timePrecisionSeconds);
client.sendMeasurement(<yourmeasurementhere>);
} catch (Exceptione) {
Log.e("MyRunnable", "upload failed", e);
}
}
}