Push Notifications for New Resources

Push Notifications for New Resources

by Abhijeet Viswa -
Number of replies: 4

Hi,

Is there any way to send Mobile push notifications to users when new resources/modules are created in the courses that the user is enrolled to?

I was able to find this discussion which basically asked to use 'Event Monitoring'.  Tests showed that this worked. But it's far from elegant for my purposes. The 'Resource Notification' also seems to work for 3.9+ though it's supported till 3.7. However, it doesn't supports only email notifications and doesn't use Moodle's messaging API/services. Is there any other plugin or workaround? Is such a feature in the works?

Thanks in advance!

Average of ratings: -
In reply to Abhijeet Viswa

Re: Push Notifications for New Resources

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Hi,

unfortunately right now there is no notification in Moodle to notify students that something was added to a course. There are plans to add more notifications in Moodle, but I don't know if this one will be one of them.

Cheers,
Dani
In reply to Dani Palou

Re: Push Notifications for New Resources

by Yogesh Patel -

Hello Dani

How are you?

I am facing issue with the moodle app push notification. I have custom mobile App using moodle web services, Means moodle as back end server. I have setup the private Airnotifier server. When the user get login into the moodle, It will add the token into the Airnotifier server. But didn't get notification on mobile when someone message that user.

In reply to Yogesh Patel

Re: Push Notifications for New Resources

by Ardian Deari -
Moodle uses special code for Airnotifier, and it must be admitted that there is a long and complicated procedure to achieve notifications (almost impossible); that's why we all need to go for an official branded version of Moodle Mobile app. Having a custom app, it's a good idea, but unfortunately, no one could make notifications fully working. I heard some people achieved that for the android version, but iOS it's a different story.
In reply to Yogesh Patel

Re: Push Notifications for New Resources

by Abhijeet Viswa -
We were able to set up Airnotifier on a custom Moodle client as well.

Firstly, setup airnotifier by cloning the master branch from airnotifier/airnotifier. For reference, we are on commit 27207bc9e8ee8f3ac9db428a456020d9e55eabda. All of this is assuming you are forking the official Moodle app, if you are making your own app from scratch then you can checkout crux-bphc/CMS-Android, specifically commits 27b342c and 98bcf43. For iOS, checkout crux-bphc/CMS-iOS.

Let's start with FCM:

Setup an Airnotifier project and provide the FCM project ID and JSON key. You have to setup your Android application to use the FCM config file. For the official Moodle app I believe all you'll need to do is to change the google-services.json file.

For APN:
The Moodle hook for Airnotifier has a bug making it incompatible with APN. Use this fork instead: chaubss/airnotifier. I did not work on the APN side for our app so I'm not sure what more there is to it on the Apple side. But the iOS/APN documentation should help you out here.

Once this is done, make sure Airnotifier works by running the server and sending a PUSH request to the Airnotifier API. The Airnotifier repository has a Postman workspace that you can use to test. Once you know Airnotifier works, it should be pretty straight forward to test with a hosted Moodle instance itself. Note that Moodle doesn't allow a namespace and you need to use a subdomain (i.e you cannot do example.com/airnotifier you need to do airnotifier.example.com). You can check if your mobile device registers itself to Moodle by using the mdl_user_devices table. Notifications can be tested by sending messages between two users or by creating discussions and making sure notifications are sent out immediately.

This explanation probably is inadequate, so if you face any trouble, do reach out.