To send more than 256 byte data via push notification - iphone

I am new in iPhone,I tried to send data up to 256 byte but i want to know how to send more than 256 byte data of image data through push notification.

No You can't.
The maximum size allowed for a notification payload is 256 bytes; Apple Push Notification Service refuses any notification that exceeds this limit.
And You have to send JSON Object in Payload.
See Local and Push Notification Programming Guide

The Notification Payload
Each push notification includes a payload. The payload contains information about how the system should alert the user as well as any custom data you provide. The maximum size allowed for a notification payload is 256 bytes; Apple Push Notification Service refuses any notification that exceeds this limit.
In this 236 is for alert message and 20 bytes is structure of message

Related

Huawei Push notifications- what is time delay for push notifications with different priority?

Check on the Time duration for High priority notification :- As in the details how long does it take for the push notification with the higher priority to reach the devices. and also about the Low and Medium priority to notification . Is there a time to time for these kind of notification. If yes what are the parameter which we can use
There is no fixed time of receiving message, it depends on your network connection generally it will take approximate in secs. But if you want to calculate exact time we have a method called getSentTime() in client side using this you can calculate how much time it will take to receive notification message but it will be varying device to device based on location and network.
Similarly you can calculate on app-server side also by sending uplink messages.
Please check below reference link which will guide you to calculate timestamp in client as well as server end:
Client Side: https://developer.huawei.com/consumer/en/doc/development/HMSCore-References-V5/remotemessage-0000001050171874-V5
getSentTime()- Obtains the time when a message is sent from the server.
Server side: https://developer.huawei.com/consumer/en/doc/development/HMSCore-References-V5/https-uplink-api-0000001050170915-V5
Request Header
X-HW-SIGNATURE - Message header signature, which is mandatory, indicating the signature information sent to your server that receives uplink messages.
X-HW-TIMESTAMP - Message header timestamp, which is mandatory, indicating the time when the Push Kit server receives uplink messages.

Apple Push Notification : Can we remove some text from notification message before it has to be displayed to user on iphone

I'm using Apple push notification service and its working fine.
But I want to remove some text from message before it has to be displayed on device.
Is there any way to do that?
The payload data which we send to APNS server is going to display on device. If you have to remove some text then it must have to remove before sending to APNS server. You can not manage notification text message.

Avoiding duplicates with Apple's Push Notification Service (APNS)

We referred to Apple's TN2265 (https://developer.apple.com/library/ios/technotes/tn2265/_index.html) for implementing error handling in our app, which sends push notifications to our users. The documentation suggests that we deal with errors asynchronously, specifically:
If you get six bytes back, that's an error response that you can check for the response code and the ID of the notification that caused the error. You'll need to send every notification following that one again.
Is it the case that in a sequence of notifications, if one fails then all notifications following it are guaranteed to have failed? If not, then how does one avoid duplicate sends of the same notification to a given device?
Yes, in that case all the notifications following it are guaranteed to not even be processed by the APNS server.
When APNS detects an invalid message, it writes the error response to the socket and closes the connection. Until you receive that error response, it's possible that you already sent more messages to Apple on the same socket. All of them won't reach Apple. Once you create a new socket you should resend all of them.
There is no risk of duplicates.

Sending messages in bulk to APNS, what happens if there is an error with some of them?

Let's say I have 3 notifications to send - a, b and c - but there is a problem with notification b. Let's assume it is an invalid token. If I do the following:
Create buffer
Add a,b and c to buffer
Send buffer to APNS server
Will message c be sent?
The Apple documentation says:
If you send a notification and APNs finds the notification malformed
or otherwise unintelligible, it returns an error-response packet prior
to disconnecting.
Does this mean that I would receive an error about b and the connection would be dropped, and therefore c would never be sent?
Message c would never be sent. If you manage to receive the error response for message b, you have to resend all the messages you sent after sending b and before receiving the response.
You can read a good article about it here : The Problem with APNS

Get JSON data from sniffing Apple push notification

I have got a wireshark trace of an apple push notification.
But i only have some kind of binary data. Is there a way of retrieving the JSON data with this packet ?
The connection to APNS is encrypted with SSL, so you would need the private key used to establish the connection.