2

I'm developing a mobile application with flutter, everything so far is ok, my app needs to check a web API for some available online courses. The problem is, I want the app to notify me when a new course appear as a result of the API call, but I cannot see a proper way to do this even if I think is very simple, I'm not looking for push notifications, just normal notifications, but I cannot find a way to check the API while the app is not opened.

Reading, the flutter_local_notifications package (https://pub.dev/packages/flutter_local_notifications), is recommended, but this seems only to work while the app is opened, even if the example have a notification schedule for X days or time, is not what I need, I cannot see a proper way to check the API on background as everything I read use Isolates and very complex flutter solutions, or just native code (which sounds no complex for me but too much work for just to show a notification).

There is something I'm missing?, there is a simple way to set a callback to my app to check this API and in a true condition show a notification?, something else to have in mind is that as I'm using APIs I don't really like to use firebase for this, implement firebase just for one notification seems too much for me.

Any hints or help will be really appreciate.

Ronald Petit
  • 474
  • 1
  • 4
  • 23
  • 1
    You have to implement native code for execution on background. But for this cases is better to use push notifications, because it's not good to keep the app running on background, polling your API constantly. The server should notify users when needed. – GaboBrandX Jun 24 '19 at 17:38
  • Sorry for being ignorant, but I don't get how the server can notify the user, I mean, how the server will communicate with the app? @GaboBrandX – Ronald Petit Jun 24 '19 at 17:42
  • Well, you need to acquire the device token in first place. Then send the push notification to that token. – GaboBrandX Jun 24 '19 at 17:46
  • Possible duplicate of [Flutter: Push notifications even if the app is closed](https://stackoverflow.com/questions/53572110/flutter-push-notifications-even-if-the-app-is-closed) – Yacine Brih Jun 24 '19 at 20:51

0 Answers0