Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set push subject as the title for push notification?

Is there any possibilities of setting push subject as the title in push notification? I'm getting app name as the subject and description is same as given in the push. I want to change the title of the push.
Is this possible in iOS? I hope it is possible in android.

like image 264
Chan Avatar asked May 14 '14 08:05

Chan


People also ask

Why do they call it push notifications?

What are push notifications? # Push messages enable you to bring information to the attention of your users even when they're not using your website. They're called push messages because you can "push" information to your users even when they're not active.

What is push vs text notification?

The primary difference between push notifications and text messages is where they are sent from and arrive. Push notifications come from apps installed on a person's phone. On the other hand, texts are sent to phone numbers from another individual's phone number or from a business application.


2 Answers

I just tested this on an iPhone 6s running iOS 9.1, and here's what I found: If the title field is provided as part of the alert dictionary, the notification on the lock screen will still show the bundle name. However, when viewing the same notification in Notification Center (accessed by swiping down from the top edge), the title is used in place of the app/bundle name.

When no title field is provided as part of the alert dictionary, the bundle name is displayed in both the lock screen and the Notification Center.

like image 85
Paul Cox Avatar answered Sep 29 '22 11:09

Paul Cox


As of 2015, Apple has started using a title attribute but only seems to use when displaying a notification on the Apple Watch.

The title string used in the short look provides a brief indication of the intent of the notification. For local notifications, you specify this string using the alertTitle property of the UILocalNotification object. For remote notifications, add the title key to the alert dictionary inside the payload

This might indicate that it will be used also on the iPhone later on.

Source: https://developer.apple.com/library/content/documentation/General/Conceptual/WatchKitProgrammingGuide/BasicSupport.html

Here's an example JSON payload: https://gist.github.com/edwardmp/2295364f068b24084e67561c8e5c2944

Edit: As of iOS 9 this started working on iPhone and iPad as well :) I do note that this appears to only be displayed in the notification center and not on the lock screen.

like image 30
edwardmp Avatar answered Sep 29 '22 10:09

edwardmp