Timetable changes (Frontend and Backend) - avinotec/Stundenplaner.FHE_EAH GitHub Wiki
Link to Backend Server: https://wi-srv7.wi.eah-jena.de
Files and their main functions
Frontend (Android-App)
PushNotificationService
- start a ServerRegistrationBackgroundTask to register the user at the server for receiving notifications about his/her subscribed courses
- receive firebase messages and process them into push notifications
ServerRegistrationBackgroundTask
- register the user at the server for receiving notifications about his/her subscribed courses by calling the backend server via the URL (example: https://wi-srv7.wi.eah-jena.de/api/fcm_register_user.php?&os=android&language=DE&fcm_token=...&eventseries_names=[...])
- add the necessary information like subscribed event series to the URL
Backend (Server)
fcm_register_user.php
- called from frontend to register a user for notifications
- insert the user (specified by the user's firebase token) in the database table fcm_user (note: updating a user's subscription is done by deleting the user's old database entry and then freshly insert the user with the latest sent list of subscripted event series)
fcm_update_and_send.php
- fetch all available module IDs from the Stundenplan Server, then fetch the module's data for each module ID and check it for changes
- for each change detected, book a notification for every user subscribing the changed event series by inserting an entry in the database table notifications with the status open
- iterate over the database notifications and send all open firebase messages the corresponding android device
TimetableDb.php
- contains methods for inserting, updating and deleting entries in the tables of the backend server
clean_notifications.php
- periodically run by a cron job to clean the table notifications to avoid collecting to much not needed data aka garbage
SQL_CREATE_tables_for_FCM.sql
- contains SQL statements to create all tables at the backend server
- index.html
- HTML with some UI for debuggers when running the server on your local computer