Note: You are currently viewing documentation for Moodle 3.3. Up-to-date documentation for the latest stable version of Moodle is probably available here: Moodle Mobile synchronization.

Moodle Mobile synchronization

From MoodleDocs

There are two ways of synchronizing data: automatic and manual.

Automatic synchronization

When an activity that can generate offline data is opened in the app, that activity will always be synchronized if the device is connected. For example, when opening a wiki while online, any offline data will be synchronized.

Furthermore, each activity type has an automatic synchronization process that runs regularly, usually every 10 minutes. Let's use wiki as an example. When the wiki synchronization process runs, it synchronizes all wikis that have offline data and haven't been synchronized in the last 5 minutes. This is to decrease the data usage of the app since the server might be down. This means that an activity could take up to 15 minutes to be synchronized in the worst case scenario. An example of the worst case scenario:

  1. Time = 0. The wiki automatic sync process runs. Nothing to sync.
  2.  Time = 5 minutes and 1 second. The user opens a wiki with no offline data, so the synchronization is successful.
  3. Time = 5 minutes and a few seconds. The user generates some offline data for that wiki.
  4. Time = 10 minutes. The wiki automatic sync process runs again. The wiki has offline data, but it has been synchronized in less than 5 minutes (step 2), so it isn't synchronized again.
  5. Time = 20 minutes. The wiki automatic sync process runs again. Now the wiki is synchronized.

If an automatic synchronization runs when the device is offline, it will stop running until the device is online again. When the device is next online, all the automatic sync processes that were stopped will be run immediately, synchronizing the activities with offline data that weren't synchronized in the last 5 minutes. For example:

  1. Forum sync process runs. Device is online, so it is executed.
  2. Device goes offline.
  3. Wiki sync process runs. Device is offline, so it stops being executed.
  4. Device goes online.
  5. Wiki sync process is executed since it was stopped. Forum isn't executed yet because it wasn't stopped, it will be executed after 10 minutes from step 1.

Finally, in App Settings > Synchronization there is a setting "Allow sync only when on Wi-Fi". If this is enabled and the device is using a 3G/4G connection, the automatic sync processes won't be run; their execution will be delayed for 10 minutes until the device uses a Wi-Fi connection.

Note that the automatic sync processes will only run if the app is alive; if the app is closed, the data won't be synchronized until it is started again. Also, in iOS the app needs to be in the foreground (active) in order to execute the sync processes; if it is put in background (minimized) the processes won't be executed until the app is in the foreground again.

Manual synchronization

When a user generates data offline, the app will display a message inside the activity informing the user that there is data to be synchronized. Performing a Pull To Refresh in that view will synchronize the data for that activity only (not for other activities). The activity can also be synchronized by opening the context menu in the top right and clicking "Synchronize". So if a user performs a Pull To Refresh in a certain wiki, only that wiki will be synchronized. Performing a Pull To Refresh outside of the activity (e.g. in the section) will do nothing.

In App Settings > Synchronization the app will display a list of the sites stored in the app. Clicking the refresh button next to a site results in all automatic sync processes being executed immediately, so all activities with offline data that haven't been synchronized in the last 5 minutes will be synchronized.