0

Google suggests to use Firebase Cloud Messaging instead GCM. It's ok. Accepted.

In the foreground I can implement FirebaseMessagingService.onMessageReceived and show 'custom' notification with localized message.

But how to implement localization of user notification messages, when application is in the background or wake-off?

This topic suggests:

Looks like you want to be handling the FCM messages yourself so you can customize the notification a bit more etc, so it would be better to not include the notification key in the POST payload, so all push messages are delivered to your onMessageReceived.

Yes, this resolved problem with background state. But when android is in wake-off state, no data-only notification received.

Community
  • 1
  • 1
Michael Andreev
  • 362
  • 2
  • 13
  • 1
    See http://stackoverflow.com/questions/37876257/push-notification-works-incorrect-when-app-is-on-background-or-not-running/37876727#37876727 – Frank van Puffelen Jun 19 '16 at 14:52
  • Ok, thanks for the link, but I need some details: does android wake up automatically to process payload (contains only a data)? – Michael Andreev Jun 22 '16 at 08:36
  • I have checked it. No data-only push notification received in sleep mode. When i wake up android manually - then this notification processed. So, problem is not solved. – Michael Andreev Jun 23 '16 at 14:58
  • Frank, write right solution or remove duplicate state please. – Michael Andreev Jun 23 '16 at 15:23
  • 1
    I have done this by using only the 'data' key in my application (no 'notification' key). I sent all the data in json format, and onMessageReceived retrieved it by this line of code `remoteMessage.getData().get("key")`. – Sudip Podder Aug 24 '16 at 06:39

0 Answers0