DonDyck
DonDyck

Reputation: 1471

How to format Push Notification with a header for each notification?

I am implementing push notification for an app for my client. One of the requirements is to display a separate header other than the app name in the pop up alert/notification center. For example, an alert should show like the following,

[App Name]

[Individual Notification Header]

[Notification String]

[Cancel] [View]

Is this possible in iPhone? If it is how can I do it?

Thanks for any help.

Upvotes: 0

Views: 2564

Answers (3)

antf
antf

Reputation: 3222

The APN notification message is not controlled by your app, it is controlled by the iOS in the device, therefore you are bound to its structure and shape and you can not change it. For this reason when an updated OS version is released, if Apple changes the shape of the APN notification it will be reflected to your app notifications although you haven't changed anything in your code or in your app. For example in iOS 5 there are multiple ways to display APNs on the device (none, banners, alert) and they are all applicable to your app even if when you created it you were using iOS 4.x.

Upvotes: 1

Ole Begemann
Ole Begemann

Reputation: 135558

You cannot influence the appearance of a notification alert.

Upvotes: 1

ima747
ima747

Reputation: 4667

I don't think so in the way exactly you want but you can probably fudge it. See Apple Documentation for exactly what you can put in a push notification. Body is the only field to cary content like you are looking for. However you should be able to put new line characters in the body... so you body could consist of

[Individual Notification Header]\n\n[Notification String]

Not literal "\n" but new line characters, that string assumes it's being handled by something that will parse properly for you... depends on what you're using to post the notifications etc. since that's all on the server.

Upvotes: 1

Related Questions