FCM Notifications


#1

my app has a cloud part as an firebase cloud functions
send notifications
how to add extra properties to data object so i can do some logic with this property when i receive in my app


#2

i need to customize the data object properties
i tray to add like this but not work

{
 "notification" : {
     "title": "title",
     "body" : "message",
     "sound": "default"
 },
 "data": {
 	"content": "whatever",
     "extra":"",
     "extra2":""
 }
}

#3

Hi mfouash,
It will work for Android:
{
“registration_ids”: [
“Device Token”
],
“notification”: {
“title”: “Title message”,
“body”: “Body message”,
“sound”: “default”,
“click_action”: “FCM_PLUGIN_ACTIVITY”
},
“data”: {
“notificationType”: “”,
“message”: “”,
“customerId”: “59670f6612d3ba0001913640”,
“status”: “NEW”
}
}

iSO:
{
“priority”: “high”,
“notification”: {
“title”: “NewRequest for Punjab Restaurant1”,
“body”: “New request created”,
“sound”: “default”,
“wasTapped”: false,
“customData”: {
“notificationType”: “”,
“consumerName”: “”,
“customerId”: “”,
“status”: “NEW”
}
},
“registration_ids”: [
“Device Token1”,
“Device Token2”
]
}


#4

Hi, i have problem with playing custom sound in ios,
what i did are set

    const options: PushOptions = {
     android: {
       sound: 'true',
       vibrate: 'true'
     },
       ios: {
           alert: 'true',
           badge: true,
           sound: 'true'
       }
    };

then

        registration_ids : this.tokenList,
        notification:{
           title: "title",
           body: "body",
           sound: "sound"
        },
        data: {
          somethiing:""
        }

in config.xml
<resource-file src="src/assets/sound/sound.wav" target="sound.wav" />

do u have any idea what went wrong, it only plays default sound for now