Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can apple push notifications send more parameters than alert and sound?

I have several pieces of metadata that I need to associate with a push notification.

For example user no, message id.

Can I send more parameters than what apple supports:

 {aps =     {     alert = joetheman;     sound = default; };} 

Is this possible?

like image 834
Atma Avatar asked Jun 28 '12 00:06

Atma


People also ask

What are the limitations of push notifications?

The visible text limitation is 30 characters for a title and 65 characters for the message body.

What is the difference between push notifications and notifications?

The main difference between push notification and notification is that the latter are created internally from an application on the device that wants to show user some information, a reminder, some news or updates, and so on.

Are iOS push notifications reliable?

Yeah, it's not reliable, in the normal network sense of the word. Is the backend pushing the messages to APNS controlled by you as well? In that case you should be able to log if some sendings to APNS fails and you could look and see if the feedback-service contains the tokens for the devices not getting the messages.

What is rich push notification in iOS?

Rich push notifications are short pop-up messages sent to a user's device with a rich media attachment such as an animated GIF, video, or audio. They allow you to communicate with your customers in an inviting way even when they're not actively using your app or visiting your website.


2 Answers

Yes. In the Push Notification Programming Guide section The Notification Payload it states

Providers can specify custom payload values outside the Apple-reserved aps namespace. Custom values must use the JSON structured and primitive types: dictionary (object), array, string, number, and Boolean. You should not include customer information as custom payload data. Instead, use it for such purposes as setting context (for the user interface) or internal metrics. For example, a custom payload value might be a conversation identifier for use by an instant-message client application or a timestamp identifying when the provider sent the notification. Any action associated with an alert message should not be destructive—for example, deleting data on the device.

So your payload might look like

{     "aps": {         "alert": "joetheman",         "sound": "default"     },     "message": "Some custom message for your app",     "id": 1234 } 

Further down on that same page are a number of examples that demonstrate this.

like image 131
Lily Ballard Avatar answered Sep 19 '22 08:09

Lily Ballard


Of course. You can send custom parameters as payload with apple push notification. Like Kevin Ballard said the payload will looks like the above. But remember one thing always you are dealing with push notification, As per the apple constraints the push notifications, The maximum size allowed for a notification payload is 256 bytes; Apple Push Notification Service refuses any notification that exceeds this. So please take this too in your consideration when you are going to add more data to notification.

like image 34
Mathew Varghese Avatar answered Sep 18 '22 08:09

Mathew Varghese