1

I am sending data to FCM server via an 'admin app' and would like the other 'non-admin app' to be able to receive push notifications, whenever the 'admin app' sends data to the FCM server.

To achieve that, I am using AWS SNS in tandem with FCM to store the list of recipients and to disseminate the push notifications. However, as opposed to the answer stated in https://stackoverflow.com/a/47413178/9846004, when the application is in the foreground, my device does not receive any push notifications; it only receives them when it is in the background.

In addition, how do I implement the feature to "open up the intended activity screen" using the "click_action" key in the payload? Do I need to include the full package name as part of the value?

Something like {"click_action" : "com.example.application.androidapp.main_activity"} or just {"click_action" : "main_activity"} will do?

  • click_action is an intent filter string, not the name of an activity. https://firebase.google.com/docs/cloud-messaging/http-server-ref – Doug Stevenson Jul 03 '18 at 15:02
  • Thanks for the response. May I clarify if you are referring to the **action name:** attribute in "Manifest.xml"? – Goh wei yang Jul 06 '18 at 01:11

1 Answers1

1

In order to receive messages while your app is in foreground, create a service that extends FirebaseMessagingService and override the onMessageReceived and onDeletedMessages methods. For more information, visit this link.

Maybe this can help.

Mehul Kanzariya
  • 888
  • 3
  • 27
  • 58