Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Moodle Mobile 2 (Ionic 1) Remote add-ons

From MoodleDocs
Revision as of 08:51, 20 May 2016 by Juan Leyva (talk | contribs) (Created page with "Only available for Moodle 3.1 onwards. A Moodle Mobile remote addon is the mobile app version of a Moodle plugin that will be loaded when a user accesses the plugin on the ap...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Only available for Moodle 3.1 onwards.

A Moodle Mobile remote addon is the mobile app version of a Moodle plugin that will be loaded when a user accesses the plugin on the app.

Moodle Mobile remote addons are stored within a Moodle plugin and are downloaded and lazy-loaded by the Mobile app in every site that uses them.

Moodle plugins can include several Mobile addons, they also can declare dependencies between plugins.

We can say that a Remote addon is an special version of a Moodle Mobile addon. The main differences are:

  • Mobile remote addons are placed inside Moodle plugins (outside the Mobile app).
  • Mobile remote addons language files must include the whole component prefix.
  • Mobile remote addons uses special placeholders for paths inside CSS files or Javascript code.

How to create a remote addon

Remote addons must be developed first as standard Moodle Mobile addons and then packaged as a remote addon.

These are the main steps required:

  • Develop the required Moodle Web Services
  • Develop a standard Moodle Mobile addon
  • Package the Moodle Mobile addon as a Remote addon
  • Include the Remote addon in your Moodle plugin

Web Services

Most of Mobile addons requires Web Services to work, but in some cases (like addons implementing question types) won't be necessary.

Please refer to Web services documentation, you have an example here: https://github.com/markn86/moodle-mod_certificate/blob/MOODLE_31_STABLE/classes/external.php

Once the Web Services has been developed, you must include them into the Mobile service using the "services" field when declaring external functions, see: https://github.com/markn86/moodle-mod_certificate/blob/MOODLE_31_STABLE/db/services.php

Remember that this is only available Moodle 3.1 onwards.

Mobile addon

Refer to Moodle Mobile Plugins Development

Remote addon packaging

Remote addon publishing

Once you have a zip file containing the remote addon you must include it into the Moodle plugin.

Please, refer to Activity_modules#mobile.php for instructions, basically you will need to create a db/mobile.php and place the zip file into mobile/addonname.zip