Communicator icon indicating copy to clipboard operation
Communicator copied to clipboard

Reachability always reports Watch Reachability, never Phone Reachability

Open We-Are-Empire opened this issue 3 years ago • 4 comments

Not sure if I'm misunderstanding the use case here, but when I observe Reachability changes when running my app from an Apple Watch, I get notified when the watch's Reachability changes, rather than the phone's Reachability. I would have expected observations made from the watch to only report changes in a companion iPhone's Reachability.

When I run the app from the iPhone and observe Reachability, I do get notifications of the watch's change in Reachability (which is what I would have thought was expected behaviour).

Is what I'm experiencing normal and expected?

We-Are-Empire avatar Mar 03 '21 03:03 We-Are-Empire

The phone is almost always immediately reachable because you can wake up the iPhone app in the background using a watchOS app, however a watch's Reachability will change very often, even if the screen is off but your watch app is still in the foreground. Since you can't wake a watch up up in the background using an Immediate message (like you can with an iOS app) then the Reachability changes to background-only messaging more frequently than the iOS app will.

In practice you won't see the phone Reachability change unless the phone is not connected via Bluetooth or on the same WiFi as the watch.

Also worth noting that the simulator isn't very reliable anymore so always best to test WatchConnectivity on a real device

KaneCheshire avatar Mar 03 '21 11:03 KaneCheshire

Thank you for the response.

Just wanted to double check if it is expected behaviour, that when I observe Reachability in the watch app, I get notified of the watch's changes? And if that is expected, is there a way to filter out those notifications?

That is, if I'm running code on the watch, I don't really want to get notified about the watch's Reachability, only the phone's (even if those events are infrequent). Does that make sense?

We-Are-Empire avatar Mar 04 '21 04:03 We-Are-Empire

You shouldn't be getting watch Reachability changes reported on your watch, if you are then it's a bug in WatchConnectivity because Communicator is just responding to delegate callbacks from WCSession which indicates whether the phone is reachable or not. It could be that your watch is just simply not able to use immediate messaging because the screen is off, so you're seeing the Reachability change to background-only messaging.

KaneCheshire avatar Mar 04 '21 08:03 KaneCheshire

@KaneCheshire may I know if this library is still updated? I am seeing the status "Build/Failing" from 9 months ago. I really love this library and am hoping to utilize it.

MichaelJoo avatar Feb 05 '22 15:02 MichaelJoo