• Payal Lodhi 16
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 2
    Replies

I  am using salesforce push notification for android device and (without the Salesforce Mobile SDK). Since payload structure of salesforce push notification is change.

{message : {data : JSON, from : String, messageId : String, ttl : Int}}

I am using local notification to show the notification banner on android device but it is not working when app is closed. 

Please let me how to resolve this. How can I show notification banne without localnotification 
Or is there a way to change the payload structure of the  Salesforce PushNotification class to like this 

{message :

   {notification : JSON, from : String, messageId : String, ttl : Int},
   {data: JSON},

}



 

I am trying to show push notification on android device. On firirng the trigger I am receiving value in  data,foreground,userInteraction fields in notification but title and message is null 
Please let me know what I am missing. Here is my trigger code to send the push notification 

I have tried Android Test notification also but got the same output

// set title ,message and other data
Map<String, Object> androidPayload = new Map<String, Object>();
androidPayload.put('title', els.text+' mentioned you in a comment');
androidPayload.put('message', body);
androidPayload.put('parentId', fi.ParentId);
androidPayload.put('id', fi.Id);
androidPayload.put('objectName', 'Account');

//to send the message info to the device 
msg.setPayload(androidPayload);
msg.send('connectedAppname', users);  

I am trying to send a mobile push notification to my android device based on apex trigger, and I didn't see notification banner but in console I can see onNotification event fired and I can see my payload info. I have followed In react native app react-native-push-notification library, all changes are done as per the document mention here https://www.npmjs.com/package/react-native-push-notification.
updated MobilePushServiceDevice whenever user open the with token and service type
On FCM created the project and follow this document https://firebase.google.com/docs/cloud-messaging/android/client
Salesforce
create connected enable push notification added server key

   Messaging.PushNotification msg = new Messaging.PushNotification();
                
                Map<String, Object> androidPayload = new Map<String, Object>();
                Set<String> userSet = new Set<String>();
                androidPayload.put('title', idVSnickname.get(cbuId)+' assigned you a task');
                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]);
                userSet.add(accIdVSuserId.get(accId));
                msg.setPayload(androidPayload);
                msg.send('Mimit', userSet);
 

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('title','title');
                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]);
                userSet.add(accIdVSuserId.get(accId));
                msg.setPayload(androidPayload);
                msg.send('connected_app', userSet);  

 

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('title','title');
                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]);
                userSet.add(accIdVSuserId.get(accId));
                msg.setPayload(androidPayload);
                msg.send('connected_app', userSet);  

 

Hello. So I already got live agent HTML/Javascript. It works fine, since it opens a pop up with the support chat.

The issue is that react native Webview doesnt support pop ups, so the chat doesnt work like it would do in a web page. Is there a way to make it work? Like to convert the pop up into a new window, or inside the same html where the "open chat" button is located