For reason unknown, I'm not able to run push notification on development environment. It doesn't show up hence I'm not able to run my application on my iOS device to check certain fields. On production, the push notification works fine.
Problem that I have right now is I want to navigate to certain page using "userId" that comes inside the notification payload. I don't know the structure of that payload. Can anybody point to structure of that payload which is being sent by Applozic server ?
let dictionary = launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification] as? [String: Any]
What is this dictionary made of ?
Really appreciate the help.
For group chat, the dictionary looks like this:
{
"AL_KEY" = "**msgtype**";
"AL_VALUE" = "{\"id\":\"**appIDhere**\",\"type\":\"**msgtype**\",\"message\":\"**AL_GROUP:groupid:userid**\",\"notifyUser\":true,\"totalUnreadCount\":0,\"sendAlert\":false,\"messageMetaData\":{}}";
aps = {
alert = "**groupname\nuserid: messagecontent**";
badge = 127;
"content-available" = 1;
sound = default;
};
}
For One - to - One chat,
{
"AL_KEY" = "**msgtype**";
"AL_VALUE" = "{\"id\":\"**appIDhere**\",\"type\":\"**msgtype**\",\"message\":\"**userid**\",\"notifyUser\":true,\"totalUnreadCount\":128,\"sendAlert\":true,\"messageMetaData\":{}}";
aps = {
alert = "**userid**: **messagecontent**";
badge = 128;
"content-available" = 1;
sound = default;
};
}
names within asterisk would be replaced by their appropriate value. Hope this is useful to you.
EDITED:
Here you can check for the AL_KEY with APPLOZIC_01 for the received message then In AL_VALUE You can get the message.
Message as two types one to one or group chat message are
1) For group chat, you can check if the first part string you can split it using : if it has AL_GROUP then its group message, the second part is groupId and 3rd part is userId who as sent the message in that group
2) For one to one, there is only one part that's the userId in the message who has sent the message in one to one chat