Moodle for mobile

Private airnotifier server

Picture of Douglas Rosa
Private airnotifier server

Hello there,

I am using a private server for the Airnotifier and also a custom version of the Moodle application. All was well for the Android version while the mobile App name was com.moodle.moodlemobile and the application name on the Airnotifier was commoodlemoodlemobile.

When I needed to enable push notifications for iOS, it did not allow the application ID bundle to be "com.moodle.moodlemobile."

So I had to create with a new name. I created another application in Airnotifier: com.douglasrosa.eadapp (comdouglasrosaeadapp) - the same name that I had placed as an ID bundle in the Apple Developer Console. I generated a new airnotifier access token for the application as well.

However, even if you change all the information in Moodle and modify config.json (app_id: com.douglasrosa.eadapp) and config.xml (widget_id = "com.douglasrosa.eadapp") of the app, nothing else works. Not even GCM for Android.

I noticed that in APP for GCM, there was still my old app name (com.moodle.moodlemobile) and then I created a new one: com.douglasrosa.eadapp. Even so, I did not succeed.

I removed all records from the user_devices and messages_airnotifier_devices table from the database. I generated all the access tokens again, but nothing at all.

Any tips? Did I forget something?

Thanks in advance

Average of ratings: -
Picture of John Valko
Re: Private airnotifier server

Douglass, I'm having the same issue: custom moodle app, using the custom Apple Bundle ID, custom app name for GCM,  reset the access token on the Airnotifier server- nothing - no love.  

It seems that only the "stock" original app id "com.moodle.moodlemobile" works.  Its the only id that seems to get entered into the mdl_user_devices table or mdl_message_airnotifier_devices table.  Very strange.  Anyone have any ideas?

Average of ratings: -
Picture of Douglas Rosa
Re: Private airnotifier server

Hey John! I got mine to work.

I did it this way:

1 - GCM and Apple Push Notifications

First, I defined what would be the Bundle ID. Lets say: com.douglasrosa.elapp

So, I created a new project in the Google Developer Console, reporting as ID com.douglasrosa.elapp.

After that, I created the application in the Apple developer account again, using the Bundle ID: com.douglasrosa.elapp (later, I generated all the certificates needed to use push notifications, as the installation tutorial for Airnotifier indicates) .

2 - Airnotifier

It is very important that the version of Airnotifier installed is exactly the one indicated by Juan in one of the guides, the branch must be moodle2. If it is not the same installation, you will have problems later.

In Airnotifier, I created a new application. The name was com.douglasrosa.elapp and the shortname comdouglasrosaealpp.

I entered the data for the GCM (ID and API Key I created in the first step). I inserted the certificates generated by Apple and started the server.

Then, I created a token with all the permissions, to use later in the Moodle configuration.

3 - Moodle

In Moodle, in addition to enabling all the necessary Webservice options, I configured the application access for Airnotifier Server (Admin -> Plugins -> Messages Outputs -> Mobile). Server address, port, app unique name (com.douglasrosa.elapp) and the short name (comdouglasrosaelapp). So I used the access key I created on the Airnotifier.

In the database tables: user_devices and message_airnotifier_devices I have removed all the records.

4 - Moodle Mobile

In the application, I've changed the places that uses the application's default name. The changes were in config.json, where app_id: com.douglasrosa.elapp) and config.xml, where I modified the widget_id = "com.douglasrosa.elapp".

I also entered in the settings the new Sender ID for GCM, project that I created in the Google Developer Console in step 1.

Even then it still was not working, so I added the phonegap-plugin-push plugin to the project:

cordova plugin add phonegap-plugin-push --variable SENDER_ID = "XXXXXXX"

(To install this plugin, you already have to have installed the COCOA in the project for iOS, in case you are planning to launch for both platforms, if you have not added yet, it will give you an error)

For iOS release notifications to work, I followed the steps in the normal installation guide and then linked the project to my Apple developer account via XCODE.

And then, after that, it started working.

Average of ratings: -
Picture of John Valko
Re: Private airnotifier server

Thank you Douglas,

The one step I was missing was adding the cordova phonegag-plugin-push - LOL, I couldn't find that is any of the guides on Moodle.  

I have two questions for you:

I'm assuming in the "cordova plugin add phonegap-plugin-push --variable SENDER_ID = "XXXXXXX""  where "XXXXXXX" is you GCM number ?   And do I still need to add the plug-in if I'm compiling via CLI - Not Phone-Gap?

Thanks again for you help on this!

Average of ratings: -
Picture of Douglas Rosa
Re: Private airnotifier server

Hey John!

Yep, the XXXXXX is your GCM project number. smile

I also did not find this information in the guides, I saw the tip on some Stack Overflow topic, it worked! I do not know if there is any other way ..

About the second question, I really do not know to tell you .. I compiled using the phone-gap.

Glad that it helped!

Average of ratings: -
Picture of Ori Wallenstein
Re: Private airnotifier server

Hi Douglas,

Can you provide the link to the github repo and branch you used for your airnotifier server?

I set up an airnotifier server and I can push notifications through it when calling it directly, but the Moodle server does not communicate with it. I suspect it is because I may be using the wrong airnotifier branch or fork.



Average of ratings: -