iOS Question How to add options for notifications?

Sandman

Expert
Licensed User
Longtime User
If we slide a notification to the left, Options will appear, next to Clear:

1645536181955.png

(Picture taken from this article.)

It's possible for the app to add at least one entry to that list. Looking closer in the picture top right, we can see a Configure in Twitter, which I imagine would open a Twitter webpage:


1645536271498.png



And for Messages, there's an Add to Contacts:

1645536380257.png



Do we have a way of adding options to that list?

I'm sorry I don't have a correct dev page at Apple to link to, I haven't even been able to figure out the correct, technical name of these notification actions.

(I did find the thread Notifications with actions, and hoped that those actions would be displayed in this list, but that didn't work.)
 

Sandman

Expert
Licensed User
Longtime User
As I'm only working with local notifications I blindly used only the code you posted in #4, but just now I realized that I also needed code from #1.

So I added that, and all of a sudden the style of actions from that thread appeared. (Where the options show like this.) The two options didn't appear like in the images above though.

My next was to be to remove one of the actions to see if there's some sort of limit where the options list show actions iff there's one action.

...but I ran into some problems. Will update here once I have that figured out. :-(

UPDATE: Problem solved, and I have posted the result of the test below.
 
Last edited:
Upvote 0

Sandman

Expert
Licensed User
Longtime User
So now I tried the code with only a single action, and it didn't work. It did show up below, just as it did when it was two, but it didn't show up in Options.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Does it? To the left I see you using the code you posted yesterday. But on the right, which action did you add to that list?
Right is from the system, you probably need another library for that. I see that WhatsApp has another point.
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Yeah, the one on the right seems to have a number of actions that are same for all notifications, but if you look in #1 in this thread you'll see that Twitter and Messages somehow have an extra action in there. That's what this thread is about, if it's possible for us to get an extra action in there.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
looks like you can't customize anything there except show the "Configure in the app" button
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Good catch! Ok, so it's not possible to add just any action there, but we can do something so the OS adds a "Configure in App" action.

This seems to be the relevant Apple page:

(I'm knowingly ignoring the fact that Messages managed to get another action in there. I'm going to assume Apple can add actions as they wish to their own apps - something that doesn't seem possible for the rest of us.)
 
Upvote 0
Top