Moodle for mobile

Moodle mobile app questions - offline, storage

 
Picture of Dani Palou
Re: Moodle mobile app questions - offline, storage
Core developersMoodle HQParticularly helpful MoodlersPlugin developers

Hi Sam!

1 Mechanism for queuing offline activity

The only way to do it right now is using the "cron" service: CoreCronDelegate. The original app (v1) had something like you're describing (a queue of WS calls), but in v2 we moved it to a cron service because it's way more powerful.

You'll see that most activities have a provider whose file name is "sync" or similar and another one called "sync-cron-handler". These providers implement a task to be used in the CoreCronDelegate, and are the ones responsible to synchronize the data. Please notice that each plugin is responsible to store its offline data. So, as you said, there is no easy way to achieve this.

You might want to look at a simple activity, like choice, to get an idea of how it looks like. You'll see that it has an offline provider, this is the one responsible of storing the data to be sent later. It can be a complex task to support all of this using the plugin system.

2 Completion (progress) tickboxes

Right now events and similar don't work in offline, it's something we've been wanted to improve for a while now but we still haven't had the chance to do it. It's in our roadmap though.

3 Deleting old data

Some activities download everything when they're opened (like Page, Book, some mod_resource, SCORM, offline quizzes), but some others only download the required part to view that page (like lesson, workshop, etc.).

a. No, we don't have any automatic deletion of data.

b. No, the data stored is exactly the same so we don't have any way to distinguish between them. It could be a nice improvement if an automatic deletion is implemented.

c. All downloadable activities implement an option to delete the data for the activity, it's accessible in the first page of the activity, using the top-right menu. The activities that implement it do:

  • Call this.courseHelper.fillContextMenu <- To load the required data, like the size of the files.
  • In the template, add a core-context-menu-item that calls removeFiles().
  • In the removeFiles function, call this.courseHelper.confirmAndRemoveFiles.

I haven't tested if this works in a plugin though. In my TODO list I have an entry about making this easier for plugins, but I'm not sure when I'll be able to take a look at that.


Please let me know if you have any other question smile

Cheers,

Dani


 
Average of ratings: Useful (1)
Picture of sam marshall
Re: Moodle mobile app questions - offline, storage
Core developersParticularly helpful MoodlersPlugin developersTesters

Thanks very much for your answers smile This is really helpful. A lot of the time, I can see what I think it is doing, but I'm not certain because I'm not still that familiar with the app so I may have missed something - getting things confirmed (or corrected) is really useful.

Re the first point about storing the offline data - we will look at choice as an example, thank you for the pointer.

Re the last one about deleting data - we hadn't spotted the delete option in activities! As a starting point we'll try to make our own plugins do the same.

--sam


 
Average of ratings: -