Installing Dropbox service.
If you are developing a data collector, PrivacyStreams offers a convenient feature:
directly uploading the collected data to your Dropbox (using DropboxOperators.uploadTo
APIs).
To use Dropbox APIs, you need to install Dropbox library in your app. Specifically:
First, add Dropbox SDK dependency to build.gradle
.
dependencies { compile 'io.github.privacystreams:privacystreams-android-sdk:0.1.7'
compile 'com.dropbox.core:dropbox-core-sdk:2.1.1'
... }
Then set Dropbox global configurations.
void collectCallLog() {
Globals.DropboxConfig.accessToken = "your dropbox access token"; // Get your token from https://www.dropbox.com/developers
Globals.DropboxConfig.leastSyncInterval = 30*60*1000; // Set the interval of uploading (30min in this example).
Globals.DropboxConfig.onlyOverWifi = false; // Set whether to upload data only over WIFI. If set to true, ACCESS_WIFI_STATE permission will be required.
// Then you can use Dropbox APIs in your program.
uqi.getData(Call.getLogs(), Purpose.RESEARCH("Collecting data."))
.forEach(DropboxOperators.<Item>uploadTo("calllog.txt", true));
}