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

Hello
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

Hello,

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

Hello,

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.

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.

Regards,
Mark

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

http://support.backendless.com/public/attachments/10c68c5e7ce1ea60b4f98908fff17056.JPG</img>

Hi SnakeEyes,

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

Regards,
Mark

Hello
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

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.