0

In my application I need to trigger an event on the Android phone from the server when the application is running in the background. This will be used, for example, to start uploading some data from the phone to the server automatically. I started implementing it by my self but then I discovered Firebase.

Firebase Cloud Messaging for instance allows me to send messages to the phone, but when the app is in the background it generates a notification and unfortunately I want the process to be automatic, I do not want the user to be annoyed with unnecessary notifications. Is there a way to avoid the notification to be showed?

Another possibility is Realtime Database that seems to be able to do this by updating a value in the DB that is automatically (if I understood it correctly) changed on the phone. I can detect this change and trigger my uploading service for instance.

Or again Jobdispatcher? I cannot understand if I can dispatch a job remotely.

I would like some advices before trying to implement each of the solutions in order to find the one that works. Thank you.

phcaze
  • 1,707
  • 5
  • 27
  • 58
  • Do you need to upload the data manually? If yes, you can send a message to the phone you don't need to show the notification if you don't want to, If not I recommend `FirebaseJobDispatcher` – Tiago Oliveira Apr 22 '17 at 19:22

1 Answers1

0

I believe that this answer is the right solution, I probably should use the "data" message type.

Community
  • 1
  • 1
phcaze
  • 1,707
  • 5
  • 27
  • 58