+ Start a Discussion
Payal Lodhi 16Payal Lodhi 16 

push notification banner is not visible in mobile device

I am trying to send push notification to android mobile device. 
I am using trigger to send push notification to mobile device and notification is received but not notification banner is not visble. I think the problem is payload sturcture 

whatever I am sending from salesforce trigger it is going in 
notification:{ data:{  /* here.... */ }}

FCM is expecting JSON like this 

notification: { title: 'title', message: 'message', data:{},...}

here is my apex code 

Messaging.PushNotification msg = new Messaging.PushNotification();
                Map<String, Object> androidPayload = new Map<String, Object>();
                Set<String> userSet = new Set<String>();
                androidPayload.put('message', subject);
                androidPayload.put('parentId', str[4].trim());
                androidPayload.put('id', str[0].trim());
                androidPayload.put('objectName', 'Task');
                androidPayload.put('record', str[5]);
                msg.send('connected_app', userSet);  


AbhishekAbhishek (Salesforce Developers) 
Hi Payal,

Refer below salesforce help article for information on this.


For further reference, you can check the below,


I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Payal Lodhi 16Payal Lodhi 16

Hi Abhishek,

Thanks for your reply. I already gone thrrough this link https://help.salesforce.com/articleView?id=000194290&type=1

I came to the conclusion that salesoforce push notification payload  is corresponding to a "data only" notification. that is why notification banner is not visible, I am using localnotification to show the banner but this solution s not working when app is closed 

Is there a way to change the payload structure ?