2

Currently I have a service, that adds all the change listeners to the realtime database (onChildAdded, onChildChanged etc.), which is started on boot. But when I start my app and then exit it and remove it from the recent apps screen, android kills it and I don't receive any database changes anymore. So I can't fire any notifications anymore, to notify the user, that there is some new data in the database.

Is there a way to do this without creating a permanent notification, which prevents android from killing the service?

Zoker
  • 2,020
  • 5
  • 32
  • 53
  • To notify the user of events when the app is not running, use [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging/) and/or [Firebase Notifications](https://firebase.google.com/docs/notifications/). – Frank van Puffelen Jun 29 '16 at 14:39
  • But I need to create a external service (e.g on a web server), which monitors the data and send the notification, right? – Zoker Jun 29 '16 at 14:42
  • Firebase Cloud Messaging doesn't support direct device-to-device messaging sending. You will indeed need an app server to send such messages. See http://stackoverflow.com/questions/37634046/is-it-possible-to-send-pushnotifications-using-firebase-cloud-messaging-fcm-t – Frank van Puffelen Jun 29 '16 at 17:01

0 Answers0