How To Integrate AirNotifier With Moodle - My Own AirNotifier
DeeSouza opened this issue · comments
- Moodle 3.5
- Ionic 2.2.3
- Cordova 6.5.0
- Moodle Mobile - Ionic 1
I installed AirNotifier on my own server, in EC2 AWS. It's working.
I have an application Moodle Mobile. This version: Moodle Mobile - Ionic 1.
And I'm using this AirNotifier:
AirNotifier - Branch Moodle2
This Moodle Mobile already have the Cordova Plugin Push.
In Moodle Administration I have already enabled Mobile Notifications:
Home > Site Administration > Plugins > Message Outputs >Mobile
See image below:
Now, I configured the AirNotifier. In Google Cloud Messaging Settings I put two data: Project Number and API KEY.
See images below:
I did all configurations, but it's not working.
What am I doing wrong?
Thanks in advanced.
I did! Coming soon I post the resolution.
What is the resolution?
This problem arises due to the mismatch between Airnotifier device types which are fcm, android & ios with Moodle version 3.7 which are android-fcm & ios-fcm.
-
Revise constants.py in Airnotifier folder & add the followings:
DEVICE_TYPE_IOS_FCM = "ios-fcm"
DEVICE_TYPE_ANDROID_FCM = "android-fcm" -
Revise push.py in api folder & revise :
from constants import (
DEVICE_TYPE_IOS,
DEVICE_TYPE_ANDROID,
DEVICE_TYPE_WNS,
DEVICE_TYPE_MPNS,
DEVICE_TYPE_SMS,
DEVICE_TYPE_FCM,
DEVICE_TYPE_IOS_FCM,
DEVICE_TYPE_ANDROID_FCM,
) -
Revise push.py line # 178 as below:
elif device == DEVICE_TYPE_FCM or device == DEVICE_TYPE_IOS_FCM or device == DEVICE_TYPE_ANDROID_FCM:
Delete push.pyc & then run the Airnotifier. It worked for me.
This problem arises due to the mismatch between Airnotifier device types which are fcm, android & ios with Moodle version 3.7 which are android-fcm & ios-fcm.
- Revise constants.py in Airnotifier folder & add the followings:
DEVICE_TYPE_IOS_FCM = "ios-fcm"
DEVICE_TYPE_ANDROID_FCM = "android-fcm"- Revise push.py in api folder & revise :
from constants import (
DEVICE_TYPE_IOS,
DEVICE_TYPE_ANDROID,
DEVICE_TYPE_WNS,
DEVICE_TYPE_MPNS,
DEVICE_TYPE_SMS,
DEVICE_TYPE_FCM,
DEVICE_TYPE_IOS_FCM,
DEVICE_TYPE_ANDROID_FCM,
)- Revise push.py line # 178 as below:
elif device == DEVICE_TYPE_FCM or device == DEVICE_TYPE_IOS_FCM or device == DEVICE_TYPE_ANDROID_FCM:
Delete push.pyc & then run the Airnotifier. It worked for me.
What branch are you using?
hi all
please use 2.x branch, it should handle the new device type sent by moodle now: https://github.com/airnotifier/airnotifier/blob/2.x/api/push.py#L111