Sign In Register

How can we help you today?

Start a new topic

Push notifications are not sent with GS messages on FCM.

I am using push notifications on iOS and Android (FCM). It works fine on Android as long as I use this template (in FCM Template -advanced-):  

{
  "notification": {
    "title": "${who}",
    "body": "${message}"
  }


But if I try to use messages I want them to be segmented by country and one template alone is not enough. So if I use the Message Template (which can be segmentable) it only works on iOS and Android doesn't receive anything; no entry pop up into the "capture-push-record" collection neither.


I actually get a capture-push-record entry now, I thought it didn't show up. Maybe I didn't notice or I changed something...


This is an example ( I still don't receive anything on my Android if I don't expliticely set a template):

 

{
  "_id": {
    "$oid": "596db9c8900bea04e4d689a2"
  },
  "sent": "Request URL:https://fcm.googleapis.com/fcm/send,Request Method:POST,Content-Type:application/json,Request Body:{ \"data\" : { \"tickerText\" : \"Tezcatlipoca dice \\\" Fdfv\\\"\" , \"subtitle\" : \"{$who}\" , \"title\" : \"{$who}\"} , \"to\" : \"eoT0NvP-7bU:APA91bG0MgQtWYPUlEYesx15DfWmbFG_FPPNN2vL5jt5loKZng9sgfea04gSfOYSCRmdr7N4m615gLMpKm7Y8A3dmxZ-p3xrUm9Wxhu5ffRMeLQWieACJBrlcnA_bPwPr8L880Sl8L8B\"}",
  "result": "Status code:200,Response body:{\"multicast_id\":7779894495346430680,\"success\":1,\"failure\":0,\"canonical_ids\":0,\"results\":[{\"message_id\":\"0:1500363208620493%027dcd1af9fd7ecd\"}]}",
  "resolvedJson": "{ \"data\" : { \"tickerText\" : \"Tezcatlipoca dice \\\" Fdfv\\\"\" , \"subtitle\" : \"{$who}\" , \"title\" : \"{$who}\"} , \"to\" : \"eoT0NvP-7bU:APA91bG0MgQtWYPUlEYesx15DfWmbFG_FPPNN2vL5jt5loKZng9sgfea04gSfOYSCRmdr7N4m615gLMpKm7Y8A3dmxZ-p3xrUm9Wxhu5ffRMeLQWieACJBrlcnA_bPwPr8L880Sl8L8B\"}",
  "type": "fcm",
  "playerId": "596b50a72d91abaf5d193e1b",
  "ts": {
    "$date": {
      "$numberLong": "1500363208657"
    }
  }
}

 


I just noticed that there is data instead of notification in the resolved JSON. Data should be managed by the application right? So I have to write some code to manage notifications on Android? Isn't it possible to set it as notification?

I did it. I set this in the FCM Message Template. 

{
  "notification": {
    "title": "${title}",
    "body": "${summary}"
  }
}

 But with this I can get only the title and the Message Template (which is the summary). The subtitle is unknown to me.


PS: Lately I am doing monologues on this Q&A.

Hi Andrea

You can see all the options for Firebase notification json in Firebase docs here.
For segmentation you can set the custom text for notifications in cloud code.

Regards
Katie


 

Login to post a comment