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) Customization

From MoodleDocs
Revision as of 10:53, 27 February 2013 by Juan Leyva (talk | contribs) (→‎Building)

Overview

In this document are described the general steps for building your custom Mobile app.

Creating your custom application

Remember that if you only want to change the global styles of the app, you can use an extra CSS file in your Moodle installation without needing to recompile the app.

Basic custom settings

In your Moodle installation you can specify a extra CSS file in the Mobile settings section

You can edit the config.json file for: - Adding a default language - Add some presets in the login screen (url and username) pointing to your installation

Development environment

See Moodle_Mobile#Testing_and_developing

It is recommended that you have a local web server (app and moodle installation under localhost or the same local domain).

You will need:

  • A Moodle installation with Web Services (REST) enabled - see Web services documentation
  • Administration -> Plugins -> Web Services -> External Services -> Enable mobile web service
  • Administration -> Plugins -> Web Services -> Protocols -> Enable REST
  • Administration -> Users -> Permission -> Define roles -> Edit the Authenticated user role -> Allow webservice/rest:use
  • A local copy of the Mobile HTML5 App with the Debugging options Enabled

Web Services Development

In most cases your plugin/s will need Web Services to get data from your Moodle installation. It is recommended that you first develop the Web Services that you will need (see Web Services).

  • Create a new External Service in your Moodle installation, adding a services.php file in your new local plugin or creating manually the service in your Moodle installation.(Plugins -> Web Services) See External services description for more info. Remember the key name of the service, because you will need it later.

Plugin Development

See Moodle Mobile Plugins Development and Moodle Mobile Developing a plugin tutorial

For developing the plugin you need:

  • Edit the /config.json file to:
  • Add the extra plugins you implement
  • Indicate the WS service name you are going to use in your Moodle installation (Remember, that you need to create a WS Service indicating the functions available for your custom app)
  • Add your custom default lang file (es, ca, fr ...) (the language file must exists in the app's lang/ folder)
  • Change the app login form presets
  • Add your own css files, custom images, etc..

Building

There are two options for building the app, aka compile it to different devices:

Phonegap Build

Phonegap Build is an online service that let you to build the app automatically for different platforms. The main advantage is that simplify a lot the process of building.

You just put your customizations in a github account and Phonegaps automatically build the app for different platforms pulling your github code.

Notice that the free version is for open repositories, but you can use the non-free version for private repositories.


Platform SDK

Using the target platform SDK you can build also your app, there is a good tutorial in Phonegap page for starting: http://docs.phonegap.com/en/2.4.0/guide_getting-started_index.md.html#Getting%20Started%20Guides


Differences between building in Phonegap and platform SDK

The main differences are:

  • In Phonegap Build you define a generic config.xml file with the icons, name of the app, and related info. For other platforms SDK you need to add this information in the files required by the SDK.
  • Phonegap Build supports two plugins used by the application: Generic Push Notifications and Childbrowser. If you want to compile the app in your SDK you need to install this plugins. See: https://build.phonegap.com/docs/plugins
  • The Android app uses an Android specific plugin called WebIntent(not supported by Phonegap Build) for opening files using the standard app selector, if you build the app using Phonegap Build a basic solution for opening files will be used. You need to install this plugin also if you want to compile the app using the Android SDK