Actionable Notification- 3rd action/button not working - ios

Is there a way to add third button in Interactive Notification,
I followed this: https://nrj.io/simple-interactive-notifications-in-ios-8
and was able to make 2 button for accept and reject and when I add
for 3rd button similar way, it doesn't not show up.

From Apple's documentation:
In iOS 8 and later, user notifications can have additional custom
actions. Two actions can be displayed on the lock screen, in a banner,
and in Notification Center. In modal alerts, notifications can display
up to four actions when the user taps the Options button.
On the lock screen and in notification center, only the first two actions will be shown. If you include additional actions (up to 4) they will be shown in modal alerts.
Note: This does not apply to the actionable notifications apple recently introduced for WatchKit which allows up to 4 that will always been shown on the Apple Watch.

Related

Notification/Widget on lock screen with button in Swift

I have an app that contains stopwatch and when time is running and the app enters background I would like to have a notification on lock screen and in Notification Center (when you swipe down). The notification should contain actual time of the stopwatches and user should be able to stop/start the stopwatches.
I was trying to achieve this using UNNotificationContentExtension but as documentation says:
When an iOS device receives a notification containing an alert, the system displays the contents of the alert in two stages. Initially, it displays an abbreviated banner with the title, subtitle, and two to four lines of body text from the notification. If the user presses the abbreviated banner, iOS displays the full notification interface, including any notification-related actions. The system provides the interface for the abbreviated banner, but you can customize the full interface using a notification content app extension.
I found out that I am able to edit just full notification interface which means that when user gets notification and opens it I can show him whatever I want (I tried mediaPlayPauseButtonType to handle stopwatches). But when I check the lockscreen the notification stays default.
What are the possibilities to achieve Notification similar to Spotify - when you play song, you can pause the song and you can see the time etc. from the lockscreen?
Thanks!

IOS notification content extension: add buttons in storyboard and handle the click action

IOS notification content extension: add buttons in MainInterface.storyboard and handle the click action without dismissing the notification
after making some research I discover that:
can not handle buttons clicks in the IOS notification content extension, only the type of button can be used is the media button, see the IOS documentation:
https://developer.apple.com/documentation/usernotificationsui/unnotificationcontentextension
The up answer is not correct, you can just add UNNotificationExtensionUserInteractionEnabled YES to the info.plist, then you can do every thing just like a common viewController
As Abdullah S. Al-Hallak said, it is not possible to perform actions that will lunch a certain screen. In Apple documentation, it is mentioned that "Do not install gesture recognizers or rely on touch events in your interface."
The only possible way is to add actions that will do some things in the presented notification only (like animation, as presented in this cool post: Adding a Custom UI and Interactivity in Local and Push Notifications)

IOS locked screen notification

Is it possible to get three options when you swipe to the left on the lock screen as yes no and cancel in iPhone when the screen is locked..
For example as shown in API for swiping to the left on lock screen - iOS 8
Seems that the lock screen can have max 2 button:
In iOS 8 and later, the lock screen, notification banners, and
notification entries in Notification Center can display one or two
custom actions.
If the alert is displayed modally you can use more:
Modal alerts can display up to four. When the user
selects a custom action, iOS notifies your app so that you can perform
the task associated with that action.
But there is no way to fore this.
Read the full spec in Registering Your Actionable Notification Types

Is it possible to have a "notification only" app, or NOT show the watch app after a notification is displayed?

The iOS app I'm working on for a client currently only uses Apple Watch for notifications.
When a local notification fires while the user's phone is locked, it displays the notification on the phone. The user can dismiss the notification or click on one of the action buttons on it.
In either case, I want to dismiss the watch app and go back to whatever state it was in (back to the watch desktop, or springboard, or whatever it's called.) I don't want to present the UI for the watch app, since there isn't one, at least not yet. I don't know if my client is going to define a watch app UI or not.
As it is now, once the user clicks the dismiss button or an action button on the notification, the user is left with a stupid-looking placeholder watch app that simply has a button called "button" (which I added for testing.)
I'm afraid that you cannot change this. iOS decides which device the notification is shown on and you have no control over this.
If the iPhone is locked then iOS assumes that you are using your watch and will deliver the notification to it, however if your iPhone is unlocked it tends to deliver to notification to the iPhone.

How many actions can be added to an iOS push notification?

What is the maximum number of actions that can be associated with a push notification and still show up on the lock screen? For example, in this picture, there are two actions. Is it possible to put more than that?
NO
banner、lock screen、notification center up to 2 actions
notification alert up to 4 actions
See:
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/NotificationCenter.html

Resources