Docs Menu

Interface ProgressListener

On this page

  • io.realm.mongodb.sync
  • Method Summary
  • Method Detail
  • onChange

Interface used when interested in updates on data either being uploaded to or downloaded from a Realm Object Server.

Modifier and Type
Method and Description
public void
Progress progress
)

This method will be called periodically from the underlying Object Server Client responsible for uploading and downloading changes from the remote Object Server.

public void onChange (
Progress progress
)

This method will be called periodically from the underlying Object Server Client responsible for uploading and downloading changes from the remote Object Server.This callback will not happen on the UI thread, but on the worker thread controlling the Object Server Client. Use Activity.runOnUiThread(Runnable) or similar to update any UI elements.

// Adding an upload progress listener that completes when all known changes have been
// uploaded.
session.addUploadProgressListener(ProgressMode.CURRENT_CHANGES, new ProgressListener() {
@Override
public void onChange(Progress progress) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
updateProgressBar(progress);
}
});
if (progress.isTransferComplete() {
session.removeProgressListener(this);
}
}
});

Parameters

  • progress - an immutable progress change event with information about current progress. This object is thread safe.
←  Class ProgressEnum ProgressMode →
Give Feedback
© 2022 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.