The Android peer-to-peer sync library is a library/component that enables apps to easily share their records/data with other devices when offline. The library supports 1-to-1 connection and the app can receive record/data updates from another app. This main purpose is to support data reporting up the administration hierarchy after it is collected on the ground where internet connection is scarce but administration has access to internet. It can also be used in many other device-to-device share use-cases
...
- Import the OpenSRP Client Core library
- Add the cwac-saferoom maven repository, as below
maven {
url "https://s3.amazonaws.com/repo.commonsware.com"
}
- Add the
P2POptions
as below when initializing the CoreLibrary:P2POptions p2POptions = new P2POptions(true);
// Add the optional configurations to the P2POptions
p2POptions.setAuthorizationService(newChwAuthorizationService());
CoreLibrary.init(context,
new
ChwSyncConfiguration(), BuildConfig.BUILD_TIMESTAMP, p2pOptions);