Airnotifier and Moodle

Airnotifier and Moodle

by Douglas Rosa -
Number of replies: 7

Hello there,

I'm building my own Mobile App for Moodle as a Final Course Project I must do. It's being built for Android at first and I'm using Moodle Webservices for communication.

I'm stuck with the AirNotifier for the push messages over the GCM. I will list the steps I followed at the creation:

  1. Created my own AirNotifier server, running on port 8801.
  2. Generated my application at AirNotifier, named moodle (short unique name) and moodleinatel (full name).
  3. Created a new project at Google and put its number at AirNotifier Project.
  4. Generated a new API Key at Google, and put it at AirNotifier Project.
  5. Saved the changes.
  6. At AirNotifier, I genereated an Access Key, with the following permissions:

    • Send broadcast
    • Create access key
    • Send notification
    • Create token
    • Delete token

  7. In my Moodle, I updated the Mobile Notifications seetings as the below:

    Settings

  8. I configured also, in Moodle, all the types of messages I wanted to go as Mobile too (and not just as e-mail).
  9. In my application, I coded a GCM Listener, to receive the notifications. The broadcast function of Airnotifier works, but.. I can't get any message from moodle. 

Any clues?


Thanks!

Douglas

Average of ratings: Useful (1)
In reply to Douglas Rosa

Re: Airnotifier and Moodle

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

The Mobile app name seems to be wrong, it cannot be just "moodle"

It should be something like com.something.wathever

In reply to Juan Leyva

Re: Airnotifier and Moodle

by Douglas Rosa -

Juan, thanks for the reply. Ok, I created another app at my Airnotifier Server, as the Image 1 shows:


Image 1

Image 1 - Airnotifier App


Then, I went at my Moodle and made the configurarions, as in the Image 2.


Image 2


Image 2 - Moodle configuration


The Airnotifier access key, I ahd to create manually, as the Image 3 shows:


Image 3

Image 3 - Airnotifier access key


I set, manually, my device token at Airnotifier, for testing purposes. Wich works when I use the "broadcast" function of Airnotifier (Images 4, 5 and 6):


Image 4

Image 4 - Device token registered


Image 5

Image 5 - Composing a broadcast message


Image 6

Image 6 - Push notification received at android GCM simulator


But, when I post a new thread or when I reply to a thread I'm subscribed at my Moodle, nothing happens regarding the push notifications. But, the e-mail notification works fine. I already made the config at moodle to send by push any forum news, as shown in the Image 7.


Image 7

Image 7 - Second Column: E-mail / Third Column: Push


What am I doing wrong?


Thanks in advance! smile

In reply to Douglas Rosa

Re: Airnotifier and Moodle

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

You should add some debugging in Moodle, edit this file:

https://github.com/moodle/moodle/blob/master/message/output/airnotifier/message_output_airnotifier.php#L113

and add

print_r($resp); die;

after $resp = $curl->post($serverurl, json_encode($params));

so you can see the server response

In any case, if you are creating a custom version of the app, you should rename your app to use your custom name to avoid collisions with the official app, something like:

xx.yourdomain.mycustommoodle

Cheers, Juan

In reply to Juan Leyva

Re: Airnotifier and Moodle

by Douglas Rosa -

Juan, 

Can you tell me "when" are the push notifications sent? I mean, is it when the Cron runs, like the e-mail notifications?

I'm kinda lost at how can I test the push notification system though Moodle.


Thanks again! smile

In reply to Juan Leyva

Re: Airnotifier and Moodle

by Douglas Rosa -

Hello Juan,


Thanks for all the help. It's working now. smile


Cheers,

Douglas

In reply to Douglas Rosa

Re: Airnotifier and Moodle

by Roberth Casanova -

Douglas Hello such, I would like to know that credentials can be authenticated at the following link https://messages.moodle.net



or I have to create my own airnotifier server? ..

for the attention that brindes to this I am very grateful


Thank you!

Regards,

Roberth Casanova



In reply to Roberth Casanova

Re: Airnotifier and Moodle

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

Hi,

That's the official Moodle HQ airnotifier instance, we (HQ) are the only ones with access there.

If you need your own server, you must install it.

Juan