Note:

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

Moodle Mobile Building the app for Android

From MoodleDocs

Installing the Android SDK

Building the app for Android is easy once you have successfully installed all the required software.

Since we are using Phonegap as framework for creating the app, the documentation you have to follow is just in this link plus additional steps for installing plugins: http://docs.phonegap.com/en/2.5.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android

Notice the following:

  • You must read carefully the document and not use white spaces in some names and ids. (It's adviced in the document)
  • You can optionally not use Eclipse and instead use adb command line or cordova script tools
  • In the "4. Setup New Project" The package_name is the app id that your app will have in the Android Market (Play Store), so it must be unique. If you are going to develop for the official app you have to use com.moodle.moodlemobile, if you are going to develop a custom app, you will have to add your own unique id.
  • If you want to connect a Device to your Eclipse and you are using Windows, you must install the Android USB Drivers, see http://developer.android.com/tools/extras/oem-usb.html#InstallingDriver

Add the Mobile app HTML5 files

Go to your project folder, assets/www and add just there all the files from https://github.com/moodlehq/moodlemobile

Installing additional Phonegap plugins

The Android app requires two additional Phonegap plugins to be installed:

WebIntent

For opening files according their mime type: https://github.com/phonegap/phonegap-plugins/tree/master/Android/WebIntent

For installing the plugin follow this instructions: https://github.com/phonegap/phonegap-plugins/blob/master/Android/WebIntent/README.md#adding-the-plugin-to-your-project

Childbrowser

For opening external browsers: https://github.com/alunny/ChildBrowser

For installing this plugin you need to use: https://github.com/imhotep/plugman (read the README and also http://shazronatadobe.wordpress.com/2012/11/07/cordova-plugins-put-them-in-your-own-repo-2/)

Note that if you are going to use Cordova 2.4, it has core support for plugman (see https://github.com/apache/cordova-cli/blob/master/README.md#project-commands) so you will not have to install plugman

Build, compile, test your app

We suggest you to use Eclipse tools for testing, deploying the app

In any case, you can allways use the Cordova command line tools, see: http://docs.phonegap.com/en/2.5.0/guide_command-line_index.md.html#Command-Line%20Usage

The cli tools are in your project folder, directory cordova

Signing your app

The Android system requires that all installed applications be digitally signed with a certificate whose private key is held by the application's developer. The Android system uses the certificate as a means of identifying the author of an application and establishing trust relationships between applications. The certificate is not used to control which applications the user can install. The certificate does not need to be signed by a certificate authority: it is perfectly allowable, and typical, for Android applications to use self-signed certificates. See: http://developer.android.com/tools/publishing/app-signing.html

And also for Eclipse: http://developer.android.com/tools/publishing/app-signing.html#ExportWizard

Uploading your custom app to the Google Play Store

Build the Android app on Mac

  1. Install SDK
  2. Set up the SDK tools/platform-tools PATH at system level
  3. Install NodeJs
  4. Install cordova-cli
    • sudo npm install -g cordova - it will install cordova
  5. Create a Android project
    • /usr/local/lib/node_modules/cordova/bin/cordova create ~/Apps/moodlemobile_android_25
    • cd ~/Apps/moodlemobile_android_25
    • sudo /usr/local/lib/node_modules/cordova/bin/cordova platform add android
    • sudo /usr/local/lib/node_modules/cordova/bin/cordova build - not necessary, just check the build works.
    • git clone git://github.com/alunny/ChildBrowser.git ./ChildBrowser - we are now going to install cordova compatible plugin with the plugin install command line.
    • sudo /usr/local/lib/node_modules/cordova/bin/cordova plugin add ChildBrowser/
  6. Add manually phonegap plugins
  7. Export the app signed for Google Play