Problems to connect MM2 on ionic with Moodle instance

Problems to connect MM2 on ionic with Moodle instance

by Zoran Jeremic -
Number of replies: 6
Hi,

I'm newbie in mobile development and so far I gained some basic knowledge in mobile development using ionic and angularJS. I'm trying to run Moodle Mobile 2 so I can implement some plugins that I already implemented for Moodle. I've followed instruction given at this url. Everything seems to be fine except that these two cordova plugins could not be installed as these are missing:

com.phonegap.plugin.statusbar

net.tunts.webintent

When I started the application in chromium, "Connect to Moodle" screen was there, but I couldn't add my local or remote web sites which are Moodle 2.6 and Moodle 2.7.  At one point, after number of attempts and app restart, my local moodle site appeared at the list of available sites and I could enter inside. However, I'm not able to add the same instance again. I'm sure it's not the problem with Moodle since I was able to connect my remote Moodle instance with MM1 application on my android phone.

Since I was able to register my local instance by  some magic, I was able to enter the course, but than I found another problem. I was not able to individual pages. An error message "mma.mod_page.errorwhileloadingthepage" appears in the modal dialog. I'm attaching some screenshots here to show you these problems.
I hope somebody will have idea if I skip something important here, or these are some bugs specific to the Moodle versions I was tested with.

registered site
failed registration

failed page loading


Average of ratings: -
In reply to Zoran Jeremic

Re: Problems to connect MM2 on ionic with Moodle instance

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

Hi Zoran,

a few things (not sure if they will solve your problems though):

  1. Use a different browser for developing and testing, please, follow this guide: https://docs.moodle.org/dev/Moodle_Mobile_development_using_Chrome_or_Chromium
  2. Remember that you need to open Chromium via command line using special flags
  3. Remember also that you nee to open Chromium before running the ionic serve --browser chromium command and ensure that the app opens in the Chromium instance already opened (and it not open a new instance)
  4. Some functionalities like BOOK, IMSCP or resource mini sites requires a device to work, so you will have to install your Android/iOs SDK and open the app via ionic run android/ios


Regards, Juan

In reply to Juan Leyva

Re: Problems to connect MM2 on ionic with Moodle instance

by Zoran Jeremic -

Hi Juan,


I tried as you suggested. I'm developing using Chrome Dev Editor. I started chromium using CLI commands

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

and then started application with

ionic serve --browser chromium-browser 

Both problems are still there. Do you have any idea how I can investigate this?


Thanks,

Zoran

In reply to Zoran Jeremic

Re: Problems to connect MM2 on ionic with Moodle instance

by Zoran Jeremic -

Hi Juan,


You were right. It seems that I didn't properly initialized chromium. Until now, I didn't have warning "You are using an unsupported command-line flag: --disable-web-security. Stability and security will suffer". Probably because I had chromium installed from ubuntu software source. Once I started chromium properly, I got everything working fine, so I can continue further.


Thanks,

Zoran

In reply to Zoran Jeremic

Re: Problems to connect MM2 on ionic with Moodle instance

by ritesh agarwal -

Hi,

I have started working on developing few features for the mobile app in moodle.

The problem I am facing is, if I run "ionic run android", and the app gets up and running on an emulator, still after entering the site URL it keeps spinning.

On the other hand, if I download the app from play store, and hit the site url, it works completely file.

This gives me an understanding that there is definitely no issue with my back end.

Please help me understand and solve this anomaly.

P.S: if I hit "ionic serve", which will run the app in 8100 port in my browser, it works fine.


Thanks

Ritesh

In reply to ritesh agarwal

Re: Problems to connect MM2 on ionic with Moodle instance

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

Hi,

you should review that you've installed all the cordova required plugins:

https://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2

You may also run adb logcat to see your emulator debuggin output to catch the error

Juan

In reply to Juan Leyva

Re: Problems to connect MM2 on ionic with Moodle instance

by ritesh agarwal -

Hi,


Thank you. Installing all the plugins separately worked for me. Now I am able to connect to my application via emulator.


Thanks

Ritesh