Calling remoteMessage.getNotification()
returns null
and
when calling remoteMessage.getData()
I get a strange object back that has an initial property _wp={
as listed below. I need to extract the alert property each time but I am not sure how.
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
RemoteMessage.Notification notification = remoteMessage.getNotification();
Map<String, String> data = remoteMessage.getData();
Log.d("DATA", remoteMessage.getData().toString());
sendNotification(data);
}
The remote data log returns the below. So I can't seem get the title and text I need to in order to construct my notification.
{_wp={"c":"01euntvtna3epk83","alert":{"text":"Body text","title":"test"},"receipt":false,"type":"simple","targetUrl":"wonderpush:\/\/notificationOpen\/default","n":"01eunu08bjla8303","reporting":{"campaignId":"01euntvtna3epk83","notificationId":"01eunu08bjla8303"},"receiptUsingMeasurements":true}, alert=Body text}
I basically want to use them with when using the NotificationCompat.Builder
.setContentTitle(title)
.setContentText(text)
Any help will be greatly appreciated.