Skip to content

Commit

Permalink
Add basic README (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
divergentdave authored Nov 15, 2023
1 parent 8c4418e commit b1fb189
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# divviup-android
An Android client library for the [Distributed Aggregation Protocol][DAP].

[DAP]: https://datatracker.ietf.org/doc/draft-ietf-ppm-dap/

## Protocol Versions and Release Branches

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 (forthcoming) | `main` | [`draft-ietf-ppm-dap-07`][draft-07] | Yes | Supported |

[draft-07]: https://datatracker.ietf.org/doc/draft-ietf-ppm-dap/07/

## Usage

Note that no published releases are available yet, so you must build this
library from source for now. Add the AAR file to your project. 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)

```java
import android.util.Log;

import org.divviup.android.Client;
import org.divviup.android.TaskId;

import java.net.URI;

public class MyRunnable implements Runnable {
public void run() {
try {
URI leaderEndpoint = new URI("https://<your leader here>/");
URI helperEndpoint = new URI("https://<your helper here>/");
TaskId taskId = TaskId.parse("<your DAP TaskId here>");
long timePrecisionSeconds = <your time precision here>;
Client<Boolean> client = Client.createPrio3Count(leaderEndpoint, helperEndpoint, taskId, timePrecisionSeconds);
client.sendMeasurement(<your measurement here>);
} catch (Exception e) {
Log.e("MyRunnable", "upload failed", e);
}
}
}
```

0 comments on commit b1fb189

Please sign in to comment.