Fórum

Push Notification Issue on iOS devices

thumbnail
Harish Kumar, modificado 7 Anos atrás.

Push Notification Issue on iOS devices

Expert Postagens: 483 Data de Entrada: 31/07/10 Postagens Recentes
Hi,

Liferay Portal - 6.2 EE
Liferay Screens: git => 'https://github.com/liferay/liferay-screens', :branch => 'hotfix/1.3.2'

We are using Liferay Push for push notification for iOS mobile app. We are using service api mentioned below -

PushNotificationsDeviceLocalServiceUtil.sendPushNotification(toUserIds, jsonPayloadObj);


Getting exceptions in logs and push notifications are not being delivered -

While Sandbox enabled

08:47:40,456 INFO  [JournalArticlesListener:102] {"body":"Harish Kumar plaatste een nieuwsbericht hks news.","notification":{"id":"390367","pageType":"News","groupId":216954,"title":"hks news","companyId":10157,"createDate":"07 juli 2016 08:47"}}
08:47:41,142 ERROR [PushNotificationsResponseMessageListener:37] {"id":"1","succeeded":false,"platform":"apple","status":"INVALID_TOKEN","token":null,"javaClass":"com.liferay.pushnotifications.sender.apple.AppleResponse","payload":null,"resent":false,"expiry":0}
08:47:41,142 ERROR [PushNotificationsResponseMessageListener:37] {"id":"1","succeeded":false,"platform":"apple","status":"Failed to deliver notification with error code 8","token":"DD0887CB25D7D7C20E9411D00DCB0F6ACD15F362BCBE6EB4827D88E511584100","javaClass":"com.liferay.pushnotifications.sender.apple.AppleResponse","payload":"{\"aps\":{\"alert\":\"Harish Kumar plaatste een nieuwsbericht hks news.\"},\"payload\":\"{\\\"notification\\\":{\\\"id\\\":\\\"390367\\\",\\\"pageType\\\":\\\"News\\\",\\\"groupId\\\":216954,\\\"title\\\":\\\"hks news\\\",\\\"companyId\\\":10157,\\\"createDate\\\":\\\"07 juli 2016 08:47\\\"}}\"}","resent":false,"expiry":2147483647}
08:47:41,688 ERROR [PushNotificationsResponseMessageListener:37] {"id":"2","succeeded":false,"platform":"apple","status":"INVALID_TOKEN","token":null,"javaClass":"com.liferay.pushnotifications.sender.apple.AppleResponse","payload":null,"resent":false,"expiry":0}
08:47:41,688 ERROR [PushNotificationsResponseMessageListener:37] {"id":"2","succeeded":false,"platform":"apple","status":"Failed to deliver notification with error code 8","token":"E3DCF9CC1F894B559F29256C3CB3B4F795C09522A79038F19BCE4E7F02EE80FF","javaClass":"com.liferay.pushnotifications.sender.apple.AppleResponse","payload":"{\"aps\":{\"alert\":\"Harish Kumar plaatste een nieuwsbericht hks news.\"},\"payload\":\"{\\\"notification\\\":{\\\"id\\\":\\\"390367\\\",\\\"pageType\\\":\\\"News\\\",\\\"groupId\\\":216954,\\\"title\\\":\\\"hks news\\\",\\\"companyId\\\":10157,\\\"createDate\\\":\\\"07 juli 2016 08:47\\\"}}\"}","resent":false,"expiry":2147483647}


While Sandbox disabled -

08:39:26,154 INFO  [JournalArticlesListener:102] {"body":"Harish Kumar plaatste een nieuwsbericht hks news.","notification":{"id":"390355","pageType":"News","groupId":216954,"title":"hks news","companyId":10157,"createDate":"07 juli 2016 08:39"}}
08:39:26,201 ERROR [JournalArticlesListener:109] java.lang.IllegalStateException: The Destination APNS server is not stated_Use .withDestination(), withSandboxDestination(), or withProductionDestination(). [Sanitized]
08:39:26,341 ERROR [PushNotificationsResponseMessageListener:37] {"id":null,"succeeded":false,"platform":"apple","status":"The Destination APNS server is not stated\nUse .withDestination(), withSandboxDestination(), or withProductionDestination().","token":null,"javaClass":"com.liferay.pushnotifications.sender.BaseResponse","payload":null}


Earlier it was working fine but now we are getting exceptions. Any pointers would be very helpful. Also let me know I can post more details regarding this issue.

Regards,
Harish
thumbnail
Bruno Farache, modificado 7 Anos atrás.

RE: Push Notification Issue on iOS devices

Liferay Master Postagens: 603 Data de Entrada: 14/05/07 Postagens Recentes
Harish,

Thw error is saying the tokens you are using are invalid. The app should reissue the token and update that on the server. Apple can invalidate tokens for several reasons, look at their documentation.

As for the second error, if you want to use Sandbox, you must choose Sandbox when generating the Push certificate. If you are getting this error is because you are using a Production certificate and for some trying to say it's a Sandbox certificate.