Responsive Ad Area

Share This Post

test

Push Notification is receiving but background fetch not calling with pn_apns tag when sending in PubNub chat message Payload

I had setup a chat module in my app using PubNub service not PubNub Chat Engine. Every thing is working fine, until push notifications come up. This app has Android version also (not built by me). I was able to receive a fully functional Apple Push Notification using payload1 mentioned bellow. But it only works for iOS devices in term of Notifications, no Notifications for Android device which has GCM added for Notification.

So i did some RND and Found this Link and used Payload2 mentioned bellow. Using this both platforms get notifications. But now in iOS Notification comes on both foreground and background app state. but all of the bellow mentioned methods does not call, the only method is now calling is willPresent in foreground. I want to know why is that. Is is some thing Wrong with Payload or Tag or what ? Kindly help me out struggling for a week for this. Thanks in advance.

payload1 = [
            "aps" : [
                "alert" : [
                    "title" : self.loginUserProfile.firstName,
                    "body" : message],
                "pn_exceptions" : [
                    tokenString
                ],
                "content-available": 1,
                "sound" : "marco_alert.aiff",
                "publisher" : self.loginUserProfile.userId,
                "date" : Date().dateString()]
            ] as [String : Any]
payload2 = [
            "pn_apns":
                [
                    "date": Date().dateString(),
                    "aps":
                        [
                            "sound": "marco_alert.aiff",
                            "alert":
                                [
                                    "title": self.loginUserProfile.firstName,
                                    "body": message
                            ],
                    ],
                    "pn_exceptions": [tokenString],
                    "publisher": self.loginUserProfile.userId,
                    "content-available": 0
            ],
            "pn_gcm": [
                "data": messageString
            ]] as [String : Any]

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void)

And

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) 

And

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)```


Push Notification is receiving but background fetch not calling with pn_apns tag when sending in PubNub chat message Payload
Push Notification is receiving but background fetch not calling with pn_apns tag when sending in PubNub chat message Payload
test
{$excerpt:n}

Share This Post

Leave a Reply

Your email address will not be Publishedd. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Skip to toolbar