Reputation: 309
Hey so basically I have a school API that provides me some informations about current courses, homeworks, etc, and so they differs depending on the current time. I would like to build an Android application around that API that would send me a notification when there is a different course happening, or when i get a new homework or anything else.
So what is the best way to achieve this? I tought about making a loop that will send a request to the API every x secondes/minutes and if it retrieves different informations than the current informations I already have, it sends a notification or anything else. But I'm not sure if it's the best way to make it.
I also heard about the observer pattern but I'm not sure if it's applicable there since I have no control on the state changement at the API level.
Thanks for you answers, I hope I'm clear about what I'm trying to achieve, feel free to ask if you want more informations.
Upvotes: 0
Views: 1924
Reputation: 2073
You will have a hard with that if you want to implement the querying within the app. I'd suggest you to build a server application that constantly queries the API and sends out a push notification (for example via Firebase Cloud Messaging) to all users that are subscribed to your server application.
Upvotes: 1