Tuesday, March 29, 2016

JavaPNS bug with 2KB payload

Starting iOS 8.0, Apple supports 2048 bytes of payload. Inorder to utilize it, application side we don’t need to make any changes, however, from the server side, if using JavaPNS library, we will have to update it to the latest versions 2.2 or 2.3 which claims to have raised that bar. However, in experience, it appeared that it is plagued by the Issue which gives exception like below 


Looking at the github source code, it appeared that the application still hardcodes the payload size to 256 and this can be found in the code PushNotificationPayload.java. 
Just changed that to 2048 and recompiled using the below, gave the latest code base and good to go to push lengthier messages! 

javac -cp .:bcprov-jdk15-146.jar:log4j-1.2.15.jar javapns/*.java javapns/communication/*.java javapns/communication/exceptions/*.java javapns/devices/*.java javapns/devices/implementations/basic/*.java  javapns/devices/exceptions/*.java javapns/feedback/*.java  javapns/notification/*.java javapns/notification/exceptions/*.java javapns/notification/management/*.java javapns/notification/transmission/*.java javapns/test/*.java

references

No comments:

Post a Comment