Moodle Mobile official app with my own Airnotifier server

Re: Moodle Mobile official app with my own Airnotifier server

by Manjunath Moodle -
Number of replies: 6

Thank you Basem, Juan & Moodle community. I finally got my custom moodle mobile app with self-hosted Airnotifier setup (non-ssl) working for gcm notification. 

Moodle Version: Moodle 3.1.1+ (Build: 20160728)  up-to-date. [AWS Ubuntu 14.04]

Airnotifier [AWS Ubuntu 14.04] - separate server

Moodle Mobile: 3.1.2 [custom app - phonegap guild published to Play Store]


Here are some errors I encountered & how they got resolved -


{"error": "Invalid token"}

- In my case this was due to wrong build of airnotifer (no excuses for this).  I reinstalled correct one -  https://github.com/moodlehq/airnotifier/tree/moodle2 (branch moodle2)'.  To uninstall wrong setup, I removed 'airnotifier' folder & I had to manually delete related mongodb database(s) before fresh setup. 


SSLError: bad handshake: Error([('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')],)

- This was due to "certifi" python library I think

- First I did the below steps (recommended by Juan in a forum post),  it still did not solve.

  https://tracker.moodle.org/browse/MDLSITE-3730

- Then, I followed this thread & reinstalled "certifi" version as suggested. It resolved the SSL error.

  http://stackoverflow.com/questions/34646942/ssl3-get-server-certificate-certificate-verify-failed-on-python-when-requesting


{"error": "There was an error authenticating the sender account."}

500 POST /api/v2/push/ (52.76.77.226) 70.72ms

- this was due to wrong API key. I could resolve it by using the correct key from "credentials' section of 'API Manager" in Google Developer Console


Lastly, device was not getting listed in the user preferences section when I logged in as admin & checked preferences of a particular user. But when I logged in as that specific user, I could see the device in the "Mobile Notifications" section. Not sure if this is how it is meant to be.  


- thanks

Average of ratings: Useful (1)
In reply to Manjunath Moodle

Re: Moodle Mobile official app with my own Airnotifier server

by sweta sadhya -


I am getting {"error": "There was an error authenticating the sender account."} wen i run test /api/v2/push now as per ur instruction in went to Credentials now there are two section  Server second Android which api key to use.
Please help.

Thanks
Sweta

In reply to sweta sadhya

Re: Moodle Mobile official app with my own Airnotifier server

by Manjunath Moodle -

HI Sweta,

   I think I created new API key & used it in airnotifier along with project number.  Hope it helps.



In reply to Manjunath Moodle

Re: Moodle Mobile official app with my own Airnotifier server

by sweta sadhya -

Hi Manjunath,


Please help us in details

1. We are generating api key from below given link. what should we put in app name and android package name. 

    https://developers.google.com/mobile/add?platform=android

App Name should be my app id which i am putting in confg.json ?

What should be package name?


Thanks

Sweta


In reply to sweta sadhya

Re: Moodle Mobile official app with my own Airnotifier server

by Manjunath Moodle -

Here is what I did -

1. Go here https://console.cloud.google.com/  - create new project (if not already done)

2. With the project selected, go to to API Manager (top left menu),  enable API for 'Google Cloud Messaging'

3. Create credentials of type 'API Key". 

4. Use the above key along with project number (you can get it under project settings in the top right menu) in your airnotifier application settings.

5. Make sure gcmpn (config.json), SENDER_ID (config.xml) in your phonegap build is same as your project number.

In reply to Manjunath Moodle

Re: Moodle Mobile official app with my own Airnotifier server

by sweta sadhya -

Hi Manjunath,


Thanks for your prompt reply.
Please let me know how to put SENDER_ID (config.xml).

Thanks
Sweta