Please, see:
The same problem here when following the http://docs.moodle.org/dev/Moodle_Mobile_Developing_a_plugin_tutorial
Mi moodle versión is 2.6.2+ with the Moodle Mobile 1.4.2
The test with the client works OK (/local/custommm/client/client.php)
I can login the app, I open a course and I click "Grades". All the activities are loaded but when I click one I get the message:
we lost connection, you need to reconnect. Your token is now invalid.
and after two seconds it goes to a black page with a pop-up:
Uncaught TypeError: Cannot read property 'id' of null
File: http://192.168.1.38/moodlemobile/lib/mm.cache.js
Line: 50
shortname with null value in mdl_external_services table
I was able to solve my "we lost connection, you need to reconnect. Your token is now invalid" problem. There was several questions...
- I was not changing the wsservice paran in the config.json
- I just added one function (local_custommm_get_grades) in the new "custommm" external service and is required to add all the functions Moodle include in the prebuilt "Moodle mobile web service" because we are not going to use this one.
- Finally the column shortname is been inserted with a null value when I create a new Custom External Webservice. Moodle does not display this value and it is required to know it to update the "wssservice" (config.json) param. Now you can solve it updating the column on the database.
update mdl_external_services set shortname='custommm' where name='custommm';
I think the last problem is a bug but I don't find nothing related on the bug trucker. Can you reproduce it?
Re: shortname with null value in mdl_external_services table
Hi,
yes, this is all explained here:
http://docs.moodle.org/dev/Moodle_Mobile_Developing_a_plugin_tutorial
I will update the FAQs anyway to point to that problem
Regards
Re: shortname with null value in mdl_external_services table
Hello Juan. If you wish I could make some modifications in this tutorial. It was the tutorial I followed and know it is fresh in my memory.
By other hand... Do you think it is a BUG the problem with the shortname when creating a new webservice? Should I open an issue?
Re: shortname with null value in mdl_external_services table
Hi,
that bug was resolved for Moodle 2.7, see:
http://docs.moodle.org/dev/Moodle_Mobile_Developing_a_plugin_tutorial#Create_your_custom_Service
Re: shortname with null value in mdl_external_services table
Thank you Juan. Now I see it.