Skip to main content
Version: 8.1.0

🔔 Push notifications

Notifications go through Firebase Cloud Messaging (FCM). You register an FCM token for each account, and EcoleDirecte's server pushes to it.

Get the FCM token​

The official app uses the Capacitor plugin @capacitor-firebase/messaging: ask for the notification permission, then FirebaseMessaging.getToken(). A token only works with the Firebase project that issued it, so it must come from EcoleDirecte's Firebase app:

Firebase value
Project idecoledirecte-6ed70
Sender id (gcm_defaultSenderId)288752977018
Android app id (google_app_id)1:288752977018:android:7fc1318d518367f4
Android packagecom.ecoledirecte.edmobile
API keygoogle_api_key in the Android APK res/values/strings.xml
info

An FCM token is bound to the Firebase project that issued it, so it has to come from EcoleDirecte's own Firebase app (above), not from your own project.

Register a push token​

Right after login, and again whenever the token changes. One registration per account.

POST /registrationAppToken.awp?verbe=put&v=8.1.0
data={
"idUser": 1234567, // account.id
"codeOgec": "0123456A", // account.codeOgec
"role": "E", // account.typeCompte
"registrationToken": "fCm0Tok3n:APA91bH…", // FCM token, see Push notifications
"oldRegistrationToken": "0ldTok3n:APA91bG…", // optional. Previous token, when it changed
"instanceId": "android" // ios, android or navigator
}

Unregister a push token​

Same body, without oldRegistrationToken.

POST /registrationAppToken.awp?verbe=delete&v=8.1.0
data={
"idUser": 1234567, // account.id
"codeOgec": "0123456A", // account.codeOgec
"role": "E", // account.typeCompte
"registrationToken": "fCm0Tok3n:APA91bH…", // FCM token, see Push notifications
"instanceId": "android" // ios, android or navigator
}

What you receive​

An FCM message with notification.title, notification.body and a data map:

{ "notification": { "title": "…", "body": "…" }, "data": { "command": "Messagerie" } }
data.commandWhat the app does
GeneriqueShows title and body in a toast when logged in
MessagerieOpens MESSAGERIE
DocumentsOpens DOCUMENTS_ELEVE for a student, DOCUMENTS otherwise
CarnetCorrespondanceOpens CARNET_CORRESPONDANCE (student, teacher, staff)
InscriptionReinscriptionOpens the home screen (family, DOSSIER_INSCRIPTION enabled)
QCMOpens QCM
EDFORMSOpens the home screen

The module is opened only when it is enabled, and its screen is reloaded.