Re: Message from iOS to watchOS
Re: Message from iOS to watchOS
- Subject: Re: Message from iOS to watchOS
- From: "J. Scott Tury" <email@hidden>
- Date: Sun, 04 Dec 2016 14:34:52 -0500
There are two concepts I think you are trying to ask in your email.
1. What are notifications?
2. How can you communicate between your iPhone and your watch app?
These are two fundamentally different questions.
Notifications:
Notifications are a way for you to deliver messages of something important to your user, and have them displayed in the OS - on the lock screen, or on a watch. You can se these with notifications that someone has sent you a Message. The OS will determine which of your devices actually displays the message.
Local Notifications allow you as a developer to not have to call a remote server to deliver a notification to the device your app is currently running on. If you have a watch paired to the current device, the notification will show up on the watch if you are not currently using your iPhone.
The following class allows you to generate Local notifications.
https://developer.apple.com/reference/usernotifications/unnotificationrequest
You might want to spend a bit of time looking over the Apple documentation as to what Notifications are, and how they work:
https://developer.apple.com/notifications/
Communicate between watchOS, and iPhone:
Use the Watch Connectivity framework to communicate between your WatchKit extension and iOS app. This allows you to send data to your companion application, and receive data from your companion application. You can see the basic information about how this works at https://developer.apple.com/library/prerelease/content/documentation/General/Conceptual/WatchKitProgrammingGuide/SharingData.html .
For class documentation you can reference:
https://developer.apple.com/reference/watchconnectivity
Hope this helps!
Scott
> On Dec 4, 2016, at 5:47 AM, Gerriet M. Denkmann <email@hidden> wrote:
>
>
>> On 4 Dec 2016, at 00:48, J. Scott Tury <email@hidden> wrote:
>>
>> Notifications for iOS will show on whatever device you are using currently. If you’re not using one, it will show up on your watch. If you’re using a iPad, it’ll show up on your iPad. If you’r using your phone - it’ll show up there.
>>
>> There is no API that sends a Notification to a particular device per se.
>>
>> I would just send a notification: Local or remote. The behavior should be essentially the same. Send the title and message in the notification. You can add in any actions you would like your user to be able to have.
>>
>> Scott
>
> One fundamental question: what does “local” in Local Notification mean?
>
> A: “local” as in local Wlan
> i.e. a local Notification gets sent to all iOS and watchOS devices in the local Wlan
>
> B: “local” as inside the same app
> i.e. i.e. a local Notification gets sent just to the sending app.
>
> I want to communicate between iOS app and watchOS app without using Apples servers.
> If (as some tests seem to indicate) B is true, then this would be useless for my purpose.
> How could one then communicate between iOS app and watchOS app?
>
> Gerriet.
>
>>
>>> Date: Sat, 03 Dec 2016 13:48:31 +0700
>>> From: "Gerriet M. Denkmann" <email@hidden>
>>> To: cocoa-dev <email@hidden>
>>> Subject: Message from iOS to watchOS
>>> Message-ID: <email@hidden>
>>> Content-Type: text/plain; charset=us-ascii
>>>
>>> I have a pair of apps: iOS + watchOS.
>>>
>>> The iOS app would like (e.g. when the user taps a button) to send some (short) info to the watchOS app.
>>> The watchOS app probably should show something like a Notification Controller Scene:
>>> Message from iOS (title)
>>> Something was done (body)
>>> Accept / Refuse (buttons)
>>>
>>> I looked at UNUserNotificationCenter, but did not see any way to specify the recipient of the notification.
>>>
>>> And I am not interested in Push Notifications.
>>>
>>> Gerriet.
>>>
>>> P.S. This is my first watch app, so I am more than usual clueless.
>>>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden