Interface ProgressListener


  • public interface ProgressListener
    Interface used when interested in updates on data either being uploaded to or downloaded from a Realm Object Server.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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.
    • Method Detail

      • onChange

        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.