iOS Rich Notifications multiple attachments (iOS 10+) - ios

How are multiple attachments handled in the UNMutableNotificationContent?
Per the apple developer documentation, I added multiple attachments to UNMutableNotificationContent.attachments, however only one of the media attachments appears with the notification after the NotificationService is triggered.
Is there a way to get the other attachments to appear?

Seems like multiple attachments still don't work (on iOS 14). Only the first attachment is displayed in either the basic notification (e.g. on the lock screen) or in the notification detail (e.g. after a long press).
So to display multiple attachments in notification detail one needs to implement a custom interface using Notification Content Extension.

Related

Define Thumbnail in iOS Notifications

if you are receiving a local or push notification on iOS 15, normally you see the app's icon on the left of the notification and have the ability to attach media that is shown as thumbnail on the right. See here:
However some notifications (communications apps?) show the profile picture of the person sending the message (eg. iMessage or Slack in the example).
I'm running a news app and would like to place the logo of the publisher there. Is it possible to manipulate the image on the left and if so, how?

Detect when a notification appears (from another application) to change my layout

Do I want to know if it's possible to detect when a notification from another application is over my app? For example, when the user receives an SMS or Messenger message. Detect the fact that a notification is present on the screen. I don't want the content of the message.
It's an example, It can be a notification for whatever. Because, when a notification is visible, my player's lost because a part of the UI is under the notification. So, if I know when a notification is visible I can change the layout.
It's not possible to handle notifications from other apps. It would be a huge privacy violation.

Swift 3- Displaying a list of previously shown local notifications within the UI

I am wondering if there is a way to show notifications within the user interface of my swift app. I have background notifications working however I want to see a list of previously alerted notifications in a tableview/viewController, sort of like a mini notification center.
Any help would be appreciated!

iOS push/local notifications with image like in iMessage

I want to display an image (custom view) in Notification Center when app receives push/local notification. e.g -
or
How could I achieve the same? Can anyone help me?
No you can't. The notification payload contains up to 256 bytes long. You can't send an image with it however you can send image URL with payload and show it in your application.
The official documentation does not provide information about this. Currently, it is possible but I guess this feature is Apple exclusive.
Adding to that what you have shown in the images is called Widget, you can create it using this link.

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.
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.
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.
You can't change the title. It's always the application name.
Suppose you are playing chess with your friend online. While you are in the chess app, your friend’s moves appear on the board right away. When you switch to another app—for example, to read email while your friend decides where to move—the app needs a way to notify you when your friend moves. This is a perfect use case for a push notification—something changed outside of the app that is of interest to the user.
The provider for the chess application learns about this move and, seeing that the chess application on your device is no longer connected, sends a push notification to Apple Push Notification service (APNs). Almost immediately, your device—or more precisely, the operating system on your device—receives the notification over the Wi-Fi or cellular connection from APNs. Because your chess application is not currently running, iOS displays an alert similar to Figure 1-1. The message consists of the application name, a short message, and (in this case) two buttons: Close and View. The button on the right is called the action button and its default title is “View”. An application can customize the title of the action button and can internationalize the button title and the message so that they are in the user’s preferred language.
You can refer your client to the official APNS docs to convince them that's the way it is.
Yes, you can add a title property since iOS 8.2.
A short string describing the purpose of the notification. Apple Watch displays this string as part of the notification interface. This string is displayed only briefly and should be crafted so that it can be understood quickly. This key was added in iOS 8.2.
Check the Apple Document - The Remote Notification Payload

Resources