How do you send Local Notifications from iPhone to an Apple Watch app when the Apple Watch app is in the background? And how do you check Local Notifications in the simulator, if possible?
The notifications shown at Apple Watch are the sames that appears in your iPhone.
If you have your iPhone locked, notifications go to the Apple Watch also.
You can not send a notification that only shows at Apple Watch.
As of Apple Docs:
Apple Watch takes full advantage of the existing interactive
notification support on iOS. If your iOS app supports notifications,
Apple Watch displays those notifications at appropriate times. When
one of your app’s local or remote notifications arrives on the user’s
iPhone, iOS decides whether to display that notification on the iPhone
or on the Apple Watch. For notifications sent to Apple Watch, the
system lets the user know subtly that a notification is available. If
the user chooses to view the notification, the system displays an
abbreviated version of the notification first, followed by a more
detailed version. The user can dismiss the detailed notification,
launch your Watch app, or act on the notification by tapping an
available action button.
Apps are not required to do anything to support notifications. The
system provides a default notification interface that displays the
alert message from the notification. However, apps can customize the
notification interface and include custom graphics, content, and
branding.
Related
I want to send notification from iOS App to the apple watch app.
I will receive push notification on iPhone. When I receive the push notification I want to send a notification to my apple watch app along with some data like name,time, and just plain text. I am new to the apple watch. I have seen an example MMWormable, but that does not send notifications. It sends only data from iOS App when both the apps are running, but i want to send notification even if app is closed on both the iPhone & Apple watch.
EDIT:
I have read https://support.apple.com/en-in/HT204791 it says it will show notifications to apple watch when if iPhone is locked & it will not show notifications on apple watch if iPhone is not locked.
How can i show notifications to both the iPhone & apple watch.
for the solution, if you use a simulator, you have to turn off the simulator with the power button according to the device, later the notification will enter the apple watch automatically
If push or local notification arrives on iPhone it will display notification only on iPhone[if the phone is unlocked].If it is locked notification will be displayed on watch. FYI notification wont be displayed on both ,OS will choose device in which user is active.
If you want than you can add it on local notification an also on watch to fetch the data.
I'm trying to create a feature where certain UILocalNotifications trigger a sound despite the fact that they are displayed in an Apple Watch, or if that's not possible, are not routed at all to the Apple Watch and just to an iPhone where they can play a sound. Having the watch produce a sound is not ideal compared to the iPhone since I need it to overlay any music the user is playing on headphones.
Obviously the user can disable notifications on the Apple Watch for the app, but there are cases where it is useful to receive notifications on the Apple Watch and that is an all-or-nothing solution.
The Apple documentation states:
When one of your app’s local or remote notifications arrives on the user’s iPhone, iOS decides whether to display that notification on the iPhone or on the Apple Watch.
Is there any information on how iOS decides where to display a notification? Is there any programmatic way to disable notification forwarding to Apple Watch?
You can selectively disable notification in apple watch: http://www.imore.com/how-turn-alerts-apps-apple-watch
See the answer in below link for app’s local or remote notifications guide:
https://stackoverflow.com/a/33581623/2401116
The Apple Watch Programming Guide states:
When one of your app’s local or remote notifications arrives on the user’s iPhone, iOS decides whether to display that notification on the iPhone or on the Apple Watch.
I can find discussion about circumstances when notifications don't don't get delivered to the Apple Watch (for example here), but what I'm really concerned with is what the behavior on the iPhone is when a remote notification does get delivered to the Apple Watch.
We have a custom alert sound bundled in our App, and specified with the sound property in our APNS notification payload. The custom sound is played on the iPhone as expected (even when the iPhone is locked) unless an Apple Watch is paired with the device. Then, the iPhone does not play the alert sound. I can't find anything definitive to say:
Is it expected/by-design behavior to ignore the sound if the notification is delivered to an Apple Watch?
Is there any way to both receive the notification on the Apple Watch and still play the custom sound?
According to this thread, custom notifications for the watch are not supported:
Custom notification sounds on Apple Watch are currently not supported.
I noticed that when your notification has no message, it will never be delivered to the watch. Thus one hack would be to send two notifications each time instead of one:
Custom sound, no message: This is going to be played on the phone, even if the screen is off.
No sound, with a message: This will play either on the watch or phone, depending on Apple's logic.
Is it possible to send instant notifications to Apple Watch from an iPhone app? The Apple Watch guide says "Apple Watch displays those notifications at appropriate times". So looks like there is no guarantee that the notification will be instant. I'm developing an iOS app that provides navigational notifications so those have to be instant.
Unfortunately WatchKit doesn't support it at this time. Not only can you not guarantee when the notification will appear, you can't even guarantee it will show up on the Watch. The OS decides which device is active and routes the notification there.
You can schedule/fire a local user notification to make it shown on the Watch, with limitations:
Users may turn off notifications of your app on Watch.
Notifications are only sent to Watch when the paired iPhone is locked, and the watch is on the wrist.
I'm trying to display local notifications in Apple Watch.
The implementation is done but I don't know how to pass local notifications to Apple Watch. How can I do this?
If your iOS app supports local or remote notifications, Apple Watch displays those notifications at appropriate times.
iOS it self decide to pass the notification to Apple Watch or show on iPhone,
As you said the implementation is done so let the iOS handle it. and at this time you have to do nothing to pass it to Watch you can see the Apple documentation for more clarification.
You can see here
iOS takes care of notifications.
If your iPhone is unlocked, you get notifications on your iPhone, instead of your Apple Watch.
If your iPhone is locked or asleep, and your Apple Watch is unlocked and on your wrist, you get notifications on your Apple Watch.
Read this
https://support.apple.com/en-in/HT204791