Skip to content

Android client for the Distributed Aggregation Protocol

License

Notifications You must be signed in to change notification settings

divviup/divviup-android

Repository files navigation

divviup-android

An Android client library for the Distributed Aggregation Protocol.

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 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

Usage

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)

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(context, leaderEndpoint, helperEndpoint, taskId, timePrecisionSeconds);
            client.sendMeasurement(<your measurement here>);
        } catch (Exception e) {
            Log.e("MyRunnable", "upload failed", e);
        }
    }
}

About

Android client for the Distributed Aggregation Protocol

Resources

License

Stars

Watchers

Forks

Packages

No packages published