dcai / airnotifier

Push Notifications Server for Human Beings.

Home Page:https://www.airnotifier.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How To Integrate AirNotifier With Moodle - My Own AirNotifier

DeeSouza opened this issue · comments

  1. Moodle 3.5
  2. Ionic 2.2.3
  3. Cordova 6.5.0
  4. 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:

image


Now, I configured the AirNotifier. In Google Cloud Messaging Settings I put two data: Project Number and API KEY.

See images below:

image

image

image

image

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?

@DeeSouza Can you help me to set up my air notifier?

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.

  1. Revise constants.py in Airnotifier folder & add the followings:
    DEVICE_TYPE_IOS_FCM = "ios-fcm"
    DEVICE_TYPE_ANDROID_FCM = "android-fcm"

  2. 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,
    )

  3. 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.

  1. Revise constants.py in Airnotifier folder & add the followings:
    DEVICE_TYPE_IOS_FCM = "ios-fcm"
    DEVICE_TYPE_ANDROID_FCM = "android-fcm"
  2. 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,
    )
  3. 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?

commented

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