1

I am construing below payload. If i send required data object inside aps object then i am able to recieve the data even when application is quit and user taps on tray,

{
                "aps": {
                                "content-available":1,
                                "alert": {
                                                "title": "Game Request",
                                                "body": "Bob wants to play poker"
                                },
                                "sound": "default",
                                "data": {
                                "alertType": "ALERT",
                                "eventTime": "121346666545454",
                                "deviceId": "657585685858",
                                "user":"Arun"
                }
                },

}

As per the standard format we have to place data outside the aps object which i saw in APNS documentation like.

{
                    "aps": {
                                    "content-available":1,
                                    "alert": {
                                                    "title": "Game Request",
                                                    "body": "Bob wants to play poker"
                                    },
                                    "sound": "default"
                    },
                    "data": {
                                    "alertType": "ALERT",
                                    "eventTime": "121346666545454",
                                    "deviceId": "657585685858",
                                    "user":"Arun"
                    }
    }

Can anyone please suggest me which is IOS APNS standard format. since i am new to IOS.

As per below URL https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW1.

we have to send the app-specific data outside the aps. if we send we are not getting in app when user comes from notification tray click.

Thanks in advance

Arun
  • 1,177
  • 9
  • 15
  • https://stackoverflow.com/a/36327058/2299040 – Sahil Manchanda May 31 '18 at 04:28
  • Thank you so much. I will look into this – Arun May 31 '18 at 04:30
  • As per this: only if it's running in background and has not been killed explicitly by the user. but as per requirement if application quit also, on tap of the notification in tray, application should get data. – Arun May 31 '18 at 04:59
  • When app is in killed state. Then on the tap of notification application(_:didFinishLaunchingWithOptions) method will be called. launchOption contains the payload if app is launched by tap on notification – Sahil Manchanda May 31 '18 at 05:18
  • I am using ionic2 that is cordova base project.Is there any options or setting to get notify , that user coming from tray – Arun May 31 '18 at 05:42
  • I am not much familiar with ionic but seems like https://forum.ionicframework.com/t/handling-click-on-notification-when-app-is-closed-minimized-open/87944/6 can give you some idea how to detect – Sahil Manchanda May 31 '18 at 06:52

0 Answers0