Moodle Mobile Push Notifications

Revision as of 03:40, 30 April 2013 by jerome mouneyrac (talk | contribs) (Apple specificities)

Jump to: navigation, search

Goal

Moodle Mobile should receive Moodle messages as push notifications on iOS and Android.

How it works

The generic way

  1. User runs the mobile app.
  2. User accepts to receive push notification.
  3. App registers the device on airnotifier (device ID).
  4. User logins on a Moodle site.
  5. App registers the device on the Moodle site (device ID to be able to receive the notification and the device name to be able to disable the device)
  6. User enables airnotifier notification in her/his Moodle profile.
  7. Moodle sends a message through airnotifier messaging provider.
  8. Airnotifier dispatches the message to the correct notification system.
  9. The user device receives the push notification.
  10. The app opens on a specific page.

Apple specificities

We start from the mobile device, when user launch the app, app should register it's device token to AirNotifier and Moodle at the same time, to register with AirNotifier, we could be sure the token is valid, the invalid token would disturb TCP connection with apple push notification server, so it's very important we do this. To register with Moodle, so moodle site could associate this token with user ID, when something interesting happened to this user, Moodle site will be able to send notification to certain device

Registering token on AirNotifier: Send POST HTTP request to http://server.name/tokens with app name (it's moodle) and app access key in HTTP header, and token in HTTP body Registering token on Moodle: Sending user ID and token, this should be done by new web service, we probably need a new table to record user tokens, NOTE, user may has multi mobile devices, so it's one-many relationship AirNotifier will issue access key to moodle installations, they share one app name: moodle, we need an admin panel in moodle to set this access key, this access keys only allow sending notifications and broadcasts, they don't have permission to register tokens, we only allow tokens being registered from mobile devices

iPhone app use a separate access key, which will be used to register device token

So we got user's device tokens in Moodle database, when somethings happened, for instance, a new instant message sent to a user who has mobile device registered. We will look for messaging processor in Moodle, this message processor is in charge of sending push notification request to AirNotifier, it will send POST HTTP request to http://server.name/notification with token and message digest in HTTP body, app name (it's moodle) and access key in http header

The message processor should be a new output type message plugin besides email, jabber and and popup In user settings page, user should have options to choose whether or not to send notification to certain devices. Broadcast, moodle site may want to broadcast messages to all registered mobile devices, it's inefficient to send individual notification to AirNotifier, it can be done by using http://server.name/broadcast service, moodle site only send one POST request to this endpoint with access key and app name in HTTP header and md5($CFG->wwwroot) in HTTP body, the hashed wwwroot is the default channel subscribed by all devices registered in AirNotifier, it will take care of broadcasting

Google specificities

Deliverables

  • push notification support on the mobile app - the app receives the push notification and behaves correctly.
  • The Airnotifier server - it sends notification to APNS / GCM.
  • The Airnotifier provider - it sends Moodle messages to Airnotifier - MDL-36445

Airnotifier messaging provider

In your messaging setting page you can select which of your devices can receive push notifications. MDL-36445 The provider has usual messaging provider settings.

Airnotifier server

  • feedback - MOBILE-191
  • load stress
  • secuirty (keys, IP banning...) - MOBILE-192
  • iOS support
  • Android support

App push notification support

Register the device on airnotifier

Register the device on Moodle site

How to deal with push notification

closed app
opened app