1

I found many answers in this topic. Example How to repeat notification daily on specific time in android through background service. I guess notifying using alarm service will become deprecated too in the future sdk versions.

Is there a way to send notification using firebase cloud messaging under certain conditions?

For Example, If child A exists for user B in firebase, then the notification should be sent from FCM to the user B, but only once per day.

raghhav
  • 167
  • 2
  • 13

1 Answers1

1

You shouldn't use any part of application to do that. Services, JobScheduler, or Work Manager are often killed to prevent battery drain.

In my opinion the best way to send notification using firebase cloud messaging under certain conditions is to use firebase functions.

Also make sure to deliver the notification to the system tray not to the application. To do that use FCM DataMessages. Data messages are delivered to system tray and are always display - even if service is not running.

MarkWalczak
  • 1,532
  • 3
  • 16
  • 24