Create a new class that performs synchronization, and implement it using the SyncParms.setSyncObserver method to receive synchronization
progress reports.
The following example illustrates a simple SyncObserver object implementation:
class MyObserver implements SyncObserver {
public boolean syncProgress(int state, SyncResult result) {
System.out.println(
"sync progress state = " + state
+ " bytes sent = " + result.getSentByteCount()
+ " bytes received = " + result.getReceivedByteCount()
);
return false; // Always continue synchronization.
}
public MyObserver() {} // The default constructor.
}
The above class can be enabled with the following method call: