Testing and developing with android emulator

Re: Testing and developing with android emulator

by Juan Leyva -
Number of replies: 2
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

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

 

 

In reply to Juan Leyva

Re: Testing and developing with android emulator

by Isaac Marco Blancas -
Picture of Core developers

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.


In reply to Isaac Marco Blancas

Re: Testing and developing with android emulator

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

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