handleActionWithIdentifier : forRemoteNotification not called WatchKit - swift

I have a notification that does not have any actions- just the default dismiss action that comes with all notifications. What method is called for the watch when a notification is tapped in the watch notification center? Not an action, but just the body of the notification.
I am looking at the Apple documentation and I'm assuming it is handleActionWithIdentifier : forRemoteNotification, but wherever I put this, it is not getting called when I tap on a notification from the notification center.
This SO question is similar, but no answers have been found that help me.
Am I correct in thinking that handleActionWithIdentifier will still work if no action was selected? According to the documentation: "If the identifier parameter contains an empty string, that means the user launched your WatchKit app from the notification interface without choosing a specific action."
Is my problem that handleActionWithIdentifier isn't called because I'm not handling an action? Or should I be using a different method?
All I need to be able to do is access the notification payload if my watch app is opened from a notification that has been sitting in the notification center. How can I do this?
Thanks in advance.

Related

NSNotificationCenter in swift 4.0? What needs to be set for a arrow label to appear when dragging down?

NSNotificationCenter in swift 4.0? What needs to be set for a label to appear when dragging?
As shown in the picture two?
For adding custom content UI to your notifications (both local and remote), you need to use Notification Content Extension.
With Notification Content Extension, you can add whatever custom interface you want to add to the notifications.
The custom UI appears on expanding the notification in the notification center.
This feature is available from iOS-10
https://medium.freecodecamp.org/ios-10-notifications-inshorts-all-in-one-ad727e03983a - Detailed discussion on notifications content extension and other concepts.
https://github.com/pgpt10/RichNotificationSample - A full-fledged example for implementing Notification content extension.

UILocalNotification actions and snoozing

I'm working on a custom app for a client and am still relatively new to iOS development. The app involves setting reminders and I'm using UILocalNotifications. Now from my research the action on the notification will always run the app but I'm really hoping someone can correct me on that. Also from what I've read you are limited to the 'View' or 'Close' options. Ideally I'd love to have 3 buttons on the notification and not have to open the app to perform an action.
I'd like a 'dismiss' option, 'snooze' option, and an 'ok' option that dismisses the notification but runs some code in the background.
I came across a notification related question where somebody suggested opening the app with a modal view and presenting the options from there. Possible, just not as clean, I guess.
Any other ideas or is this what I have to do to achieve my desired functionality? If that's the case is there a way to close the app after I've selected one of my options from the modal view?
Thanks in advance.
That is not possible, as the notification is not created by your app but by the system, so you can't customize the appearance of the notification. (also in iOS 5, the user can choose to display the notifications as banners instead of alerts, which would hide any other button than the view and close button, if that were to be possible).
Secondly there is no way to close your app, as iOS is a user centric system, where the user takes the decision on whether to open or close app, and not the app itself.

How to fire Local notification with custom view instead of default pop up according to set timer in iphone

Is there any standard step by step way to use the local notification in iPhone application.
I have never worked for local notification.
I am interested to use this to create a fake call.
So, i am interested to set the timer in the local notification & as per the timer i have to set the local notification with custom view instead of the default pop up of notification.
Please suggest me the standard way to deal with local notification.
Every type of suggestions & links are appreciable in advance.
Thanks.
You can't customize the local notification alert. I have also once searched for this. Alternatively I ended with showing the custom alert when the user accepts the local notification (similar to 2Do:Task done in style application).

show alert in home screen

I would like to make a alertView that can show in any where and don't care there is a View or Window.It just like the safe-model alert can show on the desktop which also can accept user input.
The UIAlertView and UIActiveSheet are build upon a UIView or Window.So I didn't need these kinds.I also know the application called backgrouder has such a alert,but I don't know how to implement it.
You can't. The only way to get your message displayed on the home screen like an SMS is to PUSH this message to the user. Pre condition is that your user has accepted push notifications from your application, and that you're using the Apple Push Notification Service to push info to your users.

NetBeans - Programmatically Remove NotificationDisplayer Notifications

The NetBeans API provides the org.openide.awt.NotificationDisplayer class to create and show clickable notifications in the main status line. For example,
NotificationDisplayer.notify(title, icon, detailsText, detailsAction);
The user can dismiss a notification by clicking on the X; however, I would like to programmatically clear the notifications. How can I accomplish this?
The solution I end up with was to maintain a reference to the Notification object returned by the NotificationDisplayer.notify() method. The object provides a clear() method to force removal from the status line.