how to hide close button in iOS notification on apple watch - ios

we're sending critical alerts to the user by remote notification. Users with an apple watch recieve those notifications at their watch display. at the bottom of the notification at the apple watch display, there is a "close" button displayed. If the user hits this close button, the notification seems to be purged by the os and the iphone app has no change to get the notification anymore.
As there is some data transported within the APNS Payload, this data is lost for the app.
We didn't do anything special for apple watch (like a watch app), we only deploy an ios app.
What is the preferred way to
a.) remove the close button in apple watch notification
b.) have the app to be able to access the notification payload if the user hits "close".
Any help appreciated

Related

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 to transfer user from Apple Watch Notification to Apple Watch App?

When a Push Notification is displayed on the Apple Watch, the only possibility to open the Apple Watch App is to tap the App icon in the upper left corner.
Now, as I´m reviewing our tracking data, no user seems to know this.
How can I install another tap area in the Notification View which transfers the user in the Watch App?
The first thing to understand is that notifications aren't specific to either the iPhone or the Apple Watch. They're the same old notifications we've been dealing with for years, and nothing has changed. That means that there's no such thing as an "Apple Watch-specific notification" or an "iPhone-only notification." iOS decides where to route a notification based on its own heuristics. There is no way to programmatically control which device receives an alert.
That said, stk is correct that you will have to add actions to a category that you set for your notification. The Notification Essentials section of the Apple Watch Programming Guide has some sample code.
Because there is no such thing as an iPhone- or Watch-specific notification, you're correct that you will see these actions on both devices. So, you'll have to do something meaningful on both platforms. This makes sense, because iOS decides where to send the notification, so it should be handled appropriately wherever it's sent.

Save Push Notifications and Display in UITableView

I am wanting to implement functionality similar to the Fandango and Starbucks apps where the user gets a notification in an inbox. Ideally, if the user opens the app from the notification, it would go to the appropriate view in the app. For example, if the notification is a benefit update, and the user taps the notification, the benefits view would open.
If the app is opened by tapping the app icon and not by selecting the notification, I want the notification info to be shown in a table view. I'm guessing I could just save the notification payload dictionary to an array and use that to populate the table view. I would also want to badge the inbox in the app and the app icon with the number of notifications in the array.
I'm just not sure how to go about doing this type of functionality.
You can not get the notifications in the notification screen, there is no API for it. Only when a user clicks on a notification is you app informed about the notification used to open your app.
Other apps solve this by keep track of the notifications send to the user on there server and have some API to retrieve these notifications.

How to bring application to foreground in ios?

I am detecting for iBeacon in background. When my device comes in a particular region application should comes to foreground.
It cannot be done without user interaction. The only option is you can generate a push notification to tell the user to bring the application to foreground.
This is from the Apple documentation about this issue:
When the operating system delivers push notification (iOS or OS X)
and the target application is not running in the foreground, it
presents the notification (alert, icon badge number, sound). If there
is a notification alert and the user taps or clicks the action button
(or moves the action slider), the application launches and calls a
method to pass in the local-notification object or remote-notification
payload. If the application is running in the foreground when the
notification is delivered, the application delegate receives a local
or push notification.
To answer to some comments about WhatsApp, with it, when you receive a classic vocal call, IOS use CallKit to display your call and wake up your phone, but it's not inside app. I try to make a video call with WhatsApp, and in this case, there is a notification. Press notification open app and answer to the call.
Conclusion : It's impossible to wake up app from background to foreground in IOS, but it's not really a problem because you can use notification to display what you want and get the user to your app after a touch on your notification. All of iPhone users are familiar with this kind of interaction, it's better to deal with it.

PushNotification in iOs and Application icon is clicked

I receive PushNotification as badge as well as alert and are displayed as badges on the app icon.
I receive the payload successfully when I click on alert, which appears at top area of the screen.
But, if the notification is received and I click on the application icon i don't get the payload in any of below mentioned the methods.
application:didFinishLaunchingWithOptions:
application:didReceiveRemoteNotification:
So, what could be the problem or have I missed something in handling such case.
That would be expected behavior. You don't want to show the push notification for the user if he himself did not actively chose to to tap on the alert. If user is in your app while receiving notification you can ask the user if he wants to view it or dismiss it.

Resources