public class WearableNode
- Object
- WearableNode
A device on the other end of the link: the watch as seen from the phone, or the phone as seen from the watch.
Apple pairs a phone with exactly one watch at a time, so there is at most one node there. Wear OS allows several watches paired to one phone, so a phone app can see more than one – send to all of them unless you have a reason to pick.
Constructors
public WearableNode(String id, String displayName, boolean nearby) | Creates a node description. |
Methods
public String getId() | Returns the platform’s opaque identifier for this device, stable for as long as the pairing lasts. |
public String getDisplayName() | Returns the device name a person would recognize, suitable for showing in a UI. |
public boolean isNearby() | Returns true when the device is directly connected (Bluetooth or the same network) rather than merely reachable through the cloud. |
public String toString() | Returns a string representation of the object. |
Inherited methods
Constructor details
WearableNode
public WearableNode(String id, String displayName, boolean nearby)WearableConnection.getConnectedNodes().Parameters
idString- the platform’s opaque identifier for the device
displayNameString- the device name a person would recognize
nearbyboolean- true when the device is directly connected rather than reachable over the cloud
Method details
getId
public String getId()Returns
getDisplayName
public String getDisplayName()Returns
isNearby
public boolean isNearby()Returns true when the device is directly connected (Bluetooth or the same network) rather than merely reachable through the cloud.
Informational, not a delivery rule. A cloud-routed peer still receives messages, requests
and replicated data – it appears in the connected set, which is what “connected” means –
so WearableConnection.isReachable and message delivery do not consult this. Expect higher
latency, and an actual failure is reported through the send’s own error path rather than
predicted from the transport.
Returns
toString
public String toString()