## Moodle for mobile

### Testing and developing with android emulator

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Testing and developing with android emulator

Some doc to config a developement enviroment to test the moodle mobile with android emulation on linux?

I have installed de Cordova and prepared a project for android with the CLI commads as you can read on the offcial guide http://docs.phonegap.com/en/3.4.0/guide_cli_index.md.html#The%20Command-Line%20Interface

After that I copied all the files of the moodle mobile proyect on the www folder on my new phonegap project.

$cordova platform add android and later a$ cordova emulate android

The emulator terminal is opened and the login screen appears but there's no way to do login... I always get a "Please provide a valid site URL" but the site is accesible with the android browser an the mobile and the webservices has been activated.

I can't use the "Phomegap Build" option because I just have an Iphone 4S but I'm not on the develope program so I can't test on my Iphone. I'm interested on testing with the android emulator.

Average of ratings: -
Re: Testing and developing with android emulator

You should see errors or warnings in the console, if you don't see errors you should run the app using Eclipse (the Android specific version for eclipse), you can run there the emulator and you can see the console log.

Maybe you are missing permissions in the Android manifest file for accessing Internet etc...

Find attached a sample manifest file

Average of ratings: -
Re: Testing and developing with android emulator

In console I can see:

04-27 04:53:39.343: W/IceCreamCordovaWebViewClient(1640): URL blocked by whitelist: http://192.168.1.38/moodle26/login/token.php

So I think the problem is with the "config.xml" and the <access origin="*" /> directive. I have some doubts about this file and its location on the tree. As I said I'm triying to config local development enviroment. I have installed Cordova 3.4.1-0.1.0 and Android SDK.

$cordova create MoodleMobile com.example.moodlemobile "Moodle Mobile"$ cd MoodleMobile
$cordova platform add android Now I have a "Hello Word" demo app wich I can launch with the Android emulator using this command.$ cordova emulate android

I remove all the files in the www directory and I copy there the MoodleMobile app.

Now I have two config.xml files. The first one in the root app and the second one in the MoodleMobile/www/config.xml

In Cordova documentationa you can read "For projects created with the Cordova CLI (described in The Command-Line Interface), this file can be found in the top-level directory: app/config.xml Note that before version 3.3.1-0.2.0, the file existed at app/www/config.xml, and that having it here is still supported."

I know the MoodleMobile/www/config.xml is required por de Phonegap Build compilation because it includes de list of plugins you want to be included... but I am not sure if the same config.xml file is the required or compatible with the config.xml file Cordova expect to find in app/config.xml or in app/www/config.xml when building locally apps.

The delfault app/config.xml created with the "cordova create..." comand includes a line with:

<access origin="*" />

The config.xml in the MoodleMobile/www/config.xml has not the access origin directive. Is not requiered this line for the Phonegap Build?

When I add the <access origin="*" /> to the MoodleMobile/www/config.xml I can login in the app.

By other hand I'm not sure how to deploy the required plugins to build in local.

I think I must to type this in the cordova directory created for the MoodleMobile app:

$cordova plugin add org.apache.cordova.camera$ cordova plugin add org.apache.cordova.media-capture
$cordova plugin add org.apache.cordova.console$ cordova plugin add org.apache.cordova.contacts
$cordova plugin add org.apache.cordova.device$ cordova plugin add org.apache.cordova.file
$cordova plugin add org.apache.cordova.file-transfer$ cordova plugin add org.apache.cordova.globalization
$cordova plugin add org.apache.cordova.inappbrowser$ cordova plugin add org.apache.cordova.network-information
$cordova plugin add org.apache.cordova.splashscreen$ cordova plugin add https://github.com/Tunts/WebIntent.git
\$ cordova plugin add https://github.com/phonegap-build/PushPlugin.git

I'm not sure if this is correct for the WenIntent an PushPlugin because the http://docs.moodle.org/dev/Moodle_Mobile_Building_the_app_for_Android#Installing_additional_Phonegap_plugins seems to be deprecated.

Following these steps I can run the app in my Android emulator but I haven't thi MoodleMobile icon and I haven't the splash screen... so I'm not sure wich other things I'm loosing.

Average of ratings: -
Re: Testing and developing with android emulator

Hi again Isaac,

the WebIntent plugin that we currently use is this one:

https://build.phonegap.com/plugins/363

You should try to install that version (and also the PushPlugin also in https://build.phonegap.com/plugins/)

Regarding the icon and splash screen,please read:

http://docs.phonegap.com/en/edge/config_ref_images.md.html

Regards

Average of ratings: -