To receive progress reports during synchronization, you must create a new class that performs the task, and implement it using
the SyncParms.setSyncObserver method.
The following example illustrates a simple SyncObserver:
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.
}