I have a project in mind where I would have to be able to send a tap/haptic feedback/vibration to an Apple Watch. Is this possible with Watchkit? If so, how can I accomplish it. (preferably objective-c).
Unfortunately, there is no method in WatchKit to play a sound or trigger Taptic feedback. The closest you can get is to send a UILocalNotification, but even then, you can't control where that notification is displayed, as iOS decides whether to send it to the iPhone or the Watch. Hopefully this will be added in a future update.
Related
Question:
Is there a way to detect if you get a system notification and you swipe away the notification banner (e.g. the alarm that triggers a system notification)?
More practical example:
In your app, you are doing some stuff and suddenly you get a notification from another app. Instead of tapping on the notification, you swipe up the notification (you dismiss it that way). After doing that, I want to capture that in the app.
Why:
Currently, I have a bug in the app, so if I can capture this action, I would be able to fix this bug.
Thanks in advance!
When notification appears, the willResignActiveNotification won't get called, therefore willEnterForegroundNotification won't get called, too.
The best solution here is to catch incoming notification and show the custom view describing this notification instead of system one. Thus, you can detect all actions/timings you need.
In my app, I want to implement functionality like when iPhone away with some distance from iWatch than watch app show local notification with a text message
If it is enough for you to get notified when the Watch gets disconnected from the Phone, you could use the WatchConnectivity framework to achieve this.
The optional func sessionReachabilityDidChange(_:) gets called on the Watch when it disconnects from the Phone.
However, your WatchExtension needs to be running in the foreground or with high priority in the background for this function to work.
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.
Got 2 questions for the xcode experts :
- I would like to send a (repeating) local notification only to the locked screen but without having the screen turning on, it is possible ?
- I also would like to check whether the screen is on or off (for this very purpose) : is there any way with the current IOS version (IOS 7) ?
Many thanks for any help !
No this is not possible, frits it will be very hard to get you app running in background without misusing one of the background modes.
You cannot detect if the devices is locked and you will flood the notification center with messages.
If you do manage to get it working then there is good chance that Appel will reject your app for doing this.
You can check the screen by checking the applicationState property, which will be set to UIApplicationStateInactive when the phone is set to lock/sleep (as opposed to UIApplicationStateBackground).
As for the notification, you can set a push notification delegate (I've not done it from scratch, but I did it using Urban Airship and creating my own custom push handler class) and handle whether to post an alert or not there. I'm not sure, though, whether having the phone sleep will kick notifications to the OS level, which would default to showing a notification on the screen.
I want a push notification where you could tap yes or no.If yes is tapped it would NOT open the app.
AFAIK it is not possible on iOS 6 unless you have a "Newsstand" app.
I've heard many of the newsstand-only features will be available to all apps in iOS 7 but I haven't had time to look into it yet. Maybe someone who knows more will answer.
iOS 6 can't do this - all Push notifications need to be treated as if they'll display to the user, and if they get a push when the app isn't open, it will take them to the app if they tap "Yes".
As #eran pointed out, you could modify the push notification bundle to make it only display 1 button.
iOS 7 is currently NDA so can't be discussed here. That said, if you have Xcode 5, you should have the developer doc site basically downloaded. Look at the Multitasking Guide and the Release notes.
If you have two buttons and none of them opens the app, why do you need two buttons?
If you pass null to the action-loc-key parameter, you'll get a single button that dismisses the alert without opening the app.