iOS push/local notifications with image like in iMessage - ios

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.

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?

How to create custom sticky notification without jailbreak in iOS?

According to my app requirement i have create custom notification using Notification Content Extention and Interface now i just want to make it sticky,Like it does not removable from the notification center till i remove it through my code.
Here is the reference image of sticky notification :
So can you please help me to find some alternate solution of it to make custom notification without jailbreak ?
Thanks in advance.

iOS Rich Notifications multiple attachments (iOS 10+)

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.

iOS8 APNs,cancel a notification from notification center

I need to cancel a notification from the notification center on iOS8.
You need at least 10 reputation publish pictures, but you can look at the two pictures in the following URL to see what I mean: http://www.cocoachina.com/bbs/read.php?tid-307533.html. Image one has two notifications, but in image two 未接来电(4) has been 未接来电(5).
I know the cancelAllLocalNotifications API, but how can I cancel a single notification in iOS8 new api?

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