Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Total payload size exceeds allowed limit #2

Closed
jquiambao opened this issue Oct 29, 2015 · 7 comments
Closed

Total payload size exceeds allowed limit #2

jquiambao opened this issue Oct 29, 2015 · 7 comments

Comments

@jquiambao
Copy link

I thought this fork version of javapns would allow 2KB payloads? Is there a new way of sending push so it'll bypass the payload size?

I'm sending via:

PushNotificationPayload payload = PushNotificationPayload payload = PushNotificationBigPayload.complex();
payload.addAlert("...");
payload.addCustomDictionary("mydata", hugedata.toString());

Push.payload(payload, keystore, password, isProduction, threads, devices);

javapns.notification.exceptions.PayloadMaxSizeExceededException: Total payload size exceeds allowed limit (payload is 523 bytes, limit is 256)
at javapns.notification.Payload.validateMaximumPayloadSize(Payload.java:252)
at javapns.notification.Payload.getPayloadAsBytes(Payload.java:140)
at javapns.notification.PushNotificationManager.getMessage(PushNotificationManager.java:558)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:381)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:350)
at javapns.notification.transmission.NotificationThread.runList(NotificationThread.java:228)
at javapns.notification.transmission.NotificationThread.run(NotificationThread.java:199)
at java.lang.Thread.run(Thread.java:745)

@jquiambao
Copy link
Author

Ok, I saw the problem. It looks like complex() and other constructors have not been overridden and still uses PushNotificationPayload.

@fernandospr
Copy link
Owner

Thanks @jayeatworld, I will look into this over the weekend.

@fernandospr
Copy link
Owner

@jayeatworld Now it is fixed.

@voneddy
Copy link

voneddy commented Mar 1, 2016

Hi great news you got the fix in for payload size. Is there a .jar anywhere with the fix in? I tried getting in the latest from the Maven repo (v 2.3.1) and it still reports a max file size of 256 bytes. But it also says it was added in October 2015, (looks like before your fix)...

@fernandospr
Copy link
Owner

Hi @voneddy, can you please post the code that you are using to send the notification?

@koushikckm
Copy link

Hi Fernando
Below is my exception
javapns.notification.exceptions.PayloadMaxSizeExceededException: Total payload size exceeds allowed limit (payload is 274 bytes, limit is 256)

Code used to send notification is:

To android - MulticastResult result = sender.send(message, devicesList, 1);
To iphone - List NOTIFICATIONS = Push.payload(payload, appConstants.MMG_PUSHNOTIFICATION_IPHONE_KEYSTORESSLP12_PATH, appConstants.MMG_PUSHNOTIFICATION_IPHONE_PASSWORD, true, list);

@fernandospr
Copy link
Owner

Please use PushNotificationBigPayload instead of PushNotificationPayload to build the payload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants