Displaying a push notification directly in expanded form

In the WWDC 16 Advanced Notification talk an example of writing a service extension is provided with the service adding an attachment to the notification (06:08 to 06:46).


The presenter then says "After I've done this, this is my notification" and shows what the notification looks like (06:53) and the notification is shown as displayed with a large picture taking up about 1/2 the device screen, and a couple of action buttons beneath it.


However it seems impossible to actually get a notification to appear like this using a service extension- if I try and add a picture as an attachement in a service extension the result is that the picture appears as a small icon on the right hand side of the notifiation.


The only way I can get an extension to appear like in the presentation is to use a UI extension and in addtion the user has to explicity expand the notifcation from its compact form to its expanded form.


But this is not what the presenter says, he is using a service extension and he says its displayed as a large expanded notification.


Is the WWDC presentation misleading, or is it actually possible to display a large picture in an expanded notification using only a service extension and not a ui extension?

Replies

> if I try and add a picture as an attachement in a service extension the result is that the picture appears as a small icon

> on the right hand side of the notifiation.


That is the behavior I see as well.


> The only way I can get an extension to appear like in the presentation is to use a UI extension and in addtion the user has

> to explicity expand the notifcation from its compact form to its expanded form.


Disagree with this. If I have a Notification Service that properly handles didReceiveNotificationRequestBundleResource:withContentHandler: and NO CONTENT EXTENSION, I am seeing the image that was attached displayed scaled up above the notification alert text.

See this screenshot - https://s3.amazonaws.com/innovations.alpharetta.fiserv.com/IMG_0192.PNG

My code downloads the image from the URL in the notification, saves it to phone storage, and then attaches that file to the notification. I can post code for this if you need it. Not complicated.


> Is the WWDC presentation misleading, or is it actually possible to display a large picture in an expanded notification

> using only a service extension and not a ui extension?


I am able to do it. But you do have to open it to see the "rich content". In the banner or notification Center, you only see a small thumbnail of your image (as you described).

> if I try and add a picture as an attachement in a service extension the result is that the picture appears as a small icon

> on the right hand side of the notifiation.


That is the behavior I see as well.


> The only way I can get an extension to appear like in the presentation is to use a UI extension and in addtion the user has

> to explicity expand the notifcation from its compact form to its expanded form.


Disagree with this. If I have a Notification Service that properly handlesdidReceiveNotificationRequestBundleResource:withContentHandler: and NO CONTENT EXTENSION, I am seeing the image that was attached displayed scaled up above the notification alert text.


My code downloads the image from the URL in the notification, saves it to phone storage, and then attaches that file to the notification. I can post code for this if you need it. Not complicated.


> Is the WWDC presentation misleading, or is it actually possible to display a large picture in an expanded notification

> using only a service extension and not a ui extension?


I am able to do it. But you do have to open it to see the "rich content". In the banner or notification Center, you only see a small thumbnail of your image (as you described).

This is the correct answer. On devices with 3d-touch, this is bearable, but on non-3d-touch the additional step to show it in exapnded mode is somewhat inconvenient. If this annoys you, raise your voice and open a bug report.