1

I want to create a background service in my app which will be started at device boot. I read some questions here on SO, but I didn't find a good solution.

I'm thinking to WhatsApp, which runs a background service to check if there are new messages, also with app closed or not yet opened (from boot).

I want to write code only once for both android and ios. In this background service, I need to check if there are new contents (every 5 minutes do a http request) and if firebase sends a cloud message to create a notification in the app.

I read this question and those linked, but I would to have here in this question the complete step-by-step guide to do what I want.

Now, in my app, I have only ChangeNotifierProvider and Consumer to fetch http data and place them in the widgets. I think that in background process I can run ChangeNotifier subfunctions.

What you advice?

dam034
  • 261
  • 1
  • 3
  • 13
  • Many manufacturers has advanced optimizations, which stops apps from running in background. To tackle that, you can use this plugin https://pub.dev/packages/disable_battery_optimization – Vamsi Sep 02 '20 at 18:08

1 Answers1

-1

You can try with two plugins.

Saifallak
  • 1,234
  • 2
  • 13
  • 28
Johny Saini
  • 879
  • 1
  • 5
  • 6