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): Difference between revisions

From MoodleDocs
m (small lang improvements)
Line 9: Line 9:


{{Moodle 2.4}}
{{Moodle 2.4}}
== General Overview ==
== General Overview ==


MM (Moodle Mobile) is the official mobile app for Moodle. MM is an HTML5 app that uses common web technologies.
MM (Moodle Mobile) is the official mobile app for Moodle. MM is an HTML5 app that uses common web technologies.


Basically, is a WebServices client that using REST as protocol obtain and send information to your/s Moodle installation/s.
Basically, is a Web Services client that uses REST as protocol to obtain and send information to your Moodle installation/s.
 
The layout is created using HTML5 and CSS3, interaction with the phone and packaging is done using Phonegap.


The layout is created using HTML5, CSS3, interaction with the Phone and packaging is done using Phonegap.
For calling the Web Services, manipulating the DOM and interacting with Phonegap, we use jQuery as our Javascript framework.
For calling the WebServices, manipulating the DOM and interact with Phonegap we use jQuery as our Javascript framework.


This app is a replacement of the old [[Mobile app]], see: [https://moodle.org/mod/forum/discuss.php?d=206736 Change in our Moodle mobile app strategy]
This app is a replacement of the old [[Mobile app]], see the discussion [https://moodle.org/mod/forum/discuss.php?d=206736 Change in our Moodle mobile app strategy] for details.


== Features ==
== Features ==
Line 42: Line 42:
* Moodle 2.4
* Moodle 2.4


Future versions will require the last minor versions if WebServices are not backported
Future versions will require the last minor versions if Web Services are not backported.


== Technologies used ==
== Technologies used ==
Line 74: Line 74:
=== Phonegap ===
=== Phonegap ===


MM uses Phonegap for using the Moodle hardware/software feautres like Camera, Audio/video recorder, access to the filesystem, etc..
MM uses Phonegap for using Moodle hardware/software features like Camera, Audio/video recorder, access to the file system, etc.
Phonegap is loaded in the index page of the app (jQuery, the main lib of the app are also loaded in the index page)
Phonegap is loaded in the index page of the app (jQuery, the main lib of the app are also loaded in the index page).


=== jQuery ===
=== jQuery ===


For DOM manipulation and some helper functios, is a requirement of others libraries listed bellow
For DOM manipulation and some helper functions, is a requirement of others libraries listed below.


=== jQuery UI ===
=== jQuery UI ===
Line 114: Line 114:
== Getting and sending information to Moodle ==
== Getting and sending information to Moodle ==


MM uses standard Moodle WebServices for getting and sending information to Moodle.
MM uses standard Moodle Web Services for getting and sending information to Moodle.
AJAX (jQuery) and REST + JSON are the technologies used.
AJAX (jQuery) and REST + JSON are the technologies used.


Notice that mobile HTML5 apps doesn’t have crossdomain restrictions so you can make AJAX calls to any domain.
Notice that mobile HTML5 apps doesn’t have cross domain restrictions so you can make AJAX calls to any domain.
 


== External settings ==
== External settings ==


In your Moodle installation you can specify and extra CSS file for customizing remotely the app.
In your Moodle installation you can specify an extra CSS file for customizing the app remotely.


This CSS is downloaded and stored in the device database for further uses.
This CSS is downloaded and stored in the device database for further use.


You can also translate the app strings using your Moodle translation tool because strings are sync using a specific WebService
You can also translate the app strings using your Moodle translation tool because strings are synced using a specific Web Service.


== Storage ==
== Storage ==
Line 132: Line 131:
We use HTML5 localStorage that is cross browser implemented and there are libraries that can work of top of it.
We use HTML5 localStorage that is cross browser implemented and there are libraries that can work of top of it.


We use Backbone Models and Collections as a wrapper for localStorage
We use Backbone Models and Collections as a wrapper for localStorage.
 
Notice that localStorage have some limitations like a top of 5MB size in some devices and also is consider "Temporal data" for some devices like new iPhones


Note that localStorage has some limitations like a 5MB max size in some devices and also is considers "Temporal data" for some devices like the new iPhones.


== Internationalization ==  
== Internationalization ==  


The app includes a language file in JSON (English is the default language)
The app includes a language file in JSON (English is the default language).


Once the user is logged-in, the app automatically synchronizes the string translations using a specific WebService, translations are stored in the device local database in JSON format
Once the user is logged-in, the app automatically synchronizes the string translations using a specific Web Service, translations are stored in the device local database in JSON format.


== Plugins ==
== Plugins ==
Line 152: Line 150:
=== Types of plugins ===
=== Types of plugins ===


* General: Interactions over the global app. Like the Notifications, Upload, Help and Web
* General: Interactions over the global app, such as the Notifications, Upload, Help and Web
* Course: Interactions over a course. Like course contents or participants
* Course: Interactions over a course, such as course contents or participants
* User: Interactions over an user. Like send a message, add as a contact, write a private note
* User: Interactions over an user, such as send a message, add as a contact, write a private note
* Settings: Additional settings for the app
* Settings: Additional settings for the app


=== Development ===
=== Development ===


See [[Moodle Mobile Plugins Development]]
See [[Moodle Mobile Plugins Development]].


== Creating your custom app ==
== Creating your custom app ==


See [[Moodle Mobile Customization]]
See [[Moodle Mobile Customization]].


== Testing and developing ==
== Testing and developing ==


=== Ripple ===
=== Ripple ===


Requirements: Google Chrome browser + Ripple mobile environment emulator plugin (http://ripple.tinyhippos.com/)


Requirements: Google Chrome browser + Ripple mobile environment emulator plugin (http://ripple.tinyhippos.com/)
You must run Google Chrome in Unsafe mode adding this param:


You must run Google Chrome in Unsafe mode adding this params: --allow-file-access-from-files --disable-web-security
--allow-file-access-from-files --disable-web-security


IMPORTANT: I strongly recommend you create a new link or application launch called "Google Unsafe" and use it only for testing the app
IMPORTANT: I strongly recommend you create a new link or application launch called "Google Unsafe" and use it only for testing the app.


"Path to chrome\chrome.exe" --allow-file-access-from-files --disable-web-security
"Path to chrome\chrome.exe" --allow-file-access-from-files --disable-web-security


Open the index.html file in the Google Chrome unsafe and click on the Ripple icon to activate the emulator
Open the index.html file in the Google Chrome unsafe and click on the Ripple icon to activate the emulator.


Once opened in the Ripple settings block, change Cross Domain Proxy to Disabled
Once opened in the Ripple settings block, change Cross Domain Proxy to Disabled.


Please note that some functionalities (camera, audio recording, contact) will not work in the emulator
Please note that some functionalities (camera, audio recording, contact) will not work in the emulator.


=== Platform SDK ===
=== Platform SDK ===


Install the Android or iPhone SDK and follow instructions in http://phonegap.com/start/.


Install the Android or iPhone SDK and follow instructions in http://phonegap.com/start/
=== Local web server ===


=== Local web server ===
If you deploy  the html files in a server under the same domain that the Moodle you are going to connect to you can test the application without emulator or changing the Security settings of your browser.


If you deploy  the html files in a server under the same domain that the Moodle your are going to connect to you can test the application without emulator or changing the Security settings of your browser.
In other words


I.e:
Your Moodle at http://myhost.com/moodle
Your Moodle at:
http://myhost.com/moodle


Your app at:
Your app at http://myhost.com/umm/
http://myhost.com/umm/


Notice that the mobile - related modules will not work.
Note that the mobile - related modules will not work.


== Custom Phonegap plugins ==
== Custom Phonegap plugins ==
Line 207: Line 203:
Phonegap hast a set of limited features, sometimes it’s necessary implement features that are missing in Phonegap.
Phonegap hast a set of limited features, sometimes it’s necessary implement features that are missing in Phonegap.


Push notifications is one of the most important features missing that can be solved developing a plugin for Phonegap for every specific platform you want handle this kind of notifications.
Push notifications is one of the most important features missing that can be solved by developing a plugin for Phonegap for every specific platform you want to handle this kind of notifications.
 
Developing a plugin for Phonegap means developing using the specific platform framework and language (Objective c for iOs).


Developing a Plugin for phonegap means develop using the specific platform framework and language (Objetive c for iOs).
One of the disadvantages of custom plugins is that you can still use the Phonegap online Build service for cross compiling but the feature will not be present because the online services does not allow you to add custom plugins.


One of the disadvantages of custom plugins is that you can still use the Phonegap online Build service for cross compiling but the feature will not be present because the online services does  not allow to add custom plugins.
The app can detect if the app has been compiled using the online service for disabling the plugins that uses custom Phonegap plugins automatically


The app can detect if the app have been compiled using the online service for disabling the plugins that uses custom Phonegap plugins automatically
Build process
Build process


== Limitations and disadvantages of HTML5 apps ==
== Limitations and disadvantages of HTML5 apps ==
Line 229: Line 224:
No, see http://moodle.org/mod/forum/discuss.php?d=206736#p901751
No, see http://moodle.org/mod/forum/discuss.php?d=206736#p901751


=== Whats the difference between a native app and a Mobile specific theme or responsive theme? ===
=== What is the difference between a native app and a Mobile specific theme or responsive theme? ===
 
See http://moodle.org/mod/forum/discuss.php?d=206736#p901475
See http://moodle.org/mod/forum/discuss.php?d=206736#p901475


Line 237: Line 233:


* [[Moodle Mobile Customization]]
* [[Moodle Mobile Customization]]
* [[Moodle Mobile Plugins Development]]
* [[Moodle Mobile Plugins Development]]


[[Category: Mobile]]
[[Category: Mobile]]

Revision as of 14:32, 24 January 2013

Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please join the discussion on moodle.org or use the page comments.

Moodle Mobile
Project state Implementation
Tracker issue MOBILE-153
Discussion https://moodle.org/mod/forum/discuss.php?d=206736
Assignee Juan Leyva


Moodle 2.4

General Overview

MM (Moodle Mobile) is the official mobile app for Moodle. MM is an HTML5 app that uses common web technologies.

Basically, is a Web Services client that uses REST as protocol to obtain and send information to your Moodle installation/s.

The layout is created using HTML5 and CSS3, interaction with the phone and packaging is done using Phonegap.

For calling the Web Services, manipulating the DOM and interacting with Phonegap, we use jQuery as our Javascript framework.

This app is a replacement of the old Mobile app, see the discussion Change in our Moodle mobile app strategy for details.

Features

The features are going to be the same that the old Mobile app plus:

  • PUSH Notifications
  • Mobile and tablet version (Responsive design)
  • Support for contrib plugins
  • Support for external settings: Extra CSS
  • Support for external translation
  • New development and debugging features

Features for future versions:

  • Calendar sync
  • Offline browsing and posting in forums
  • Offline grading

Requirements

  • Moodle 2.4

Future versions will require the last minor versions if Web Services are not backported.

Technologies used

  • RequireJS requirejs.org

Phonegap

MM uses Phonegap for using Moodle hardware/software features like Camera, Audio/video recorder, access to the file system, etc. Phonegap is loaded in the index page of the app (jQuery, the main lib of the app are also loaded in the index page).

jQuery

For DOM manipulation and some helper functions, is a requirement of others libraries listed below.

jQuery UI

Dialogs and also for enhancing forms elements (buttons, checkboxes, etc...)

jQuery touchSwipe

For detecting mouse gestures

matchMedia

Javascript detection of media queries

Backbone and Underscore

For storage (Models and Collections), Underscore templates, and URL Routing

RequireJS

For handling modules dependencies and loading plugins

Structure of the app (only main directories)

css/ - App main layout and styles
img/ - App images
lang/ - Default lang
lib/ - Main libraries
plugins/ - Plugins
test/ - Test data when developing in Test mode
config.json - Main app configuration file (presets)
index.html - Index page of the app

Getting and sending information to Moodle

MM uses standard Moodle Web Services for getting and sending information to Moodle. AJAX (jQuery) and REST + JSON are the technologies used.

Notice that mobile HTML5 apps doesn’t have cross domain restrictions so you can make AJAX calls to any domain.

External settings

In your Moodle installation you can specify an extra CSS file for customizing the app remotely.

This CSS is downloaded and stored in the device database for further use.

You can also translate the app strings using your Moodle translation tool because strings are synced using a specific Web Service.

Storage

We use HTML5 localStorage that is cross browser implemented and there are libraries that can work of top of it.

We use Backbone Models and Collections as a wrapper for localStorage.

Note that localStorage has some limitations like a 5MB max size in some devices and also is considers "Temporal data" for some devices like the new iPhones.

Internationalization

The app includes a language file in JSON (English is the default language).

Once the user is logged-in, the app automatically synchronizes the string translations using a specific Web Service, translations are stored in the device local database in JSON format.

Plugins

Overview

Plugins allow developers to extend the app functionalities. A plugin it’s a subdirectory that implements a set of required functionalities.

Types of plugins

  • General: Interactions over the global app, such as the Notifications, Upload, Help and Web
  • Course: Interactions over a course, such as course contents or participants
  • User: Interactions over an user, such as send a message, add as a contact, write a private note
  • Settings: Additional settings for the app

Development

See Moodle Mobile Plugins Development.

Creating your custom app

See Moodle Mobile Customization.

Testing and developing

Ripple

Requirements: Google Chrome browser + Ripple mobile environment emulator plugin (http://ripple.tinyhippos.com/)

You must run Google Chrome in Unsafe mode adding this param:

--allow-file-access-from-files --disable-web-security

IMPORTANT: I strongly recommend you create a new link or application launch called "Google Unsafe" and use it only for testing the app.

"Path to chrome\chrome.exe" --allow-file-access-from-files --disable-web-security

Open the index.html file in the Google Chrome unsafe and click on the Ripple icon to activate the emulator.

Once opened in the Ripple settings block, change Cross Domain Proxy to Disabled.

Please note that some functionalities (camera, audio recording, contact) will not work in the emulator.

Platform SDK

Install the Android or iPhone SDK and follow instructions in http://phonegap.com/start/.

Local web server

If you deploy the html files in a server under the same domain that the Moodle you are going to connect to you can test the application without emulator or changing the Security settings of your browser.

In other words

Your Moodle at http://myhost.com/moodle

Your app at http://myhost.com/umm/

Note that the mobile - related modules will not work.

Custom Phonegap plugins

Phonegap hast a set of limited features, sometimes it’s necessary implement features that are missing in Phonegap.

Push notifications is one of the most important features missing that can be solved by developing a plugin for Phonegap for every specific platform you want to handle this kind of notifications.

Developing a plugin for Phonegap means developing using the specific platform framework and language (Objective c for iOs).

One of the disadvantages of custom plugins is that you can still use the Phonegap online Build service for cross compiling but the feature will not be present because the online services does not allow you to add custom plugins.

The app can detect if the app has been compiled using the online service for disabling the plugins that uses custom Phonegap plugins automatically

Build process

Limitations and disadvantages of HTML5 apps

  • Less speed and smoothness
  • Limited to the Mobile functionalities provided from Phonegap

FAQ

Is the app a replacement of the MyMobile theme?

No, see http://moodle.org/mod/forum/discuss.php?d=206736#p901751

What is the difference between a native app and a Mobile specific theme or responsive theme?

See http://moodle.org/mod/forum/discuss.php?d=206736#p901475

Also http://moodle.org/mod/forum/discuss.php?d=206736#p901751

See also