Support Topics Documentation Slack YouTube Blog

Android to iOS push notification (how to get the message part)

(SnakeEyes) #1

I am sending push notification from android to iOS. I am putting the headers and including a message (which is Json string).

On ios, I am receiving it and I able to see the headers. But how can I extract the message component. I don’t seem to find out how. Any help is appreciated thanks

(Olga Danylova) #2


You can handle push notifications in the didReceiveRemoteNotification method. userInfo contains information related to the remote notification. The message value is associated with the “alert” key.

Regards, Olga

(SnakeEyes) #3


there is no alert key. There is only ios-alert key which has only the info passed from android in the ios-alert.
Basically the message passed is not populated anywhere in ios userinfo (although it is received correctly on android). This happens when sent from Android to IOS.
As a work around , we are adding a new header called “message” which gets received as a header.

(Mark Piller) #4

Could you please set a breakpoint on the code where you receive the message and take a screenshot showing what the message contains? Please attach the screenshot to this topic.


(SnakeEyes) #5

Here is the screenshot of the received notification. There should be a json string included (the message being sent)</img>

(Mark Piller) #6

Hi SnakeEyes,

When the “ios-alert” header is set, the message is being ignored. Have you tried passing the message via custom headers?


(SnakeEyes) #7

Yes that was my work around. To use custom headers, I was just not sure why the message wouldn’t appear. So you are saying that ios-alert and the message are mutually exclusive

(Mark Piller) #8

Yes, that’s correct. The code checks if the “ios-alert” header is set and if so, uses it. Otherwise, it gets the value from the message.