Detect when wearable connected/disconnected to/from Android phone

前端 未结 3 1492
没有蜡笔的小新
没有蜡笔的小新 2021-01-18 21:57

The Pebble watch has a Intent that is globally sended when the Pebble is connected/disconnected. This allow the phone apps to know if the watch is connected or not. I have s

3条回答
  •  旧巷少年郎
    2021-01-18 22:12

    Have you tried NodeApi, you can use getConnectedNodes

    Gets a list of Nodes to which this device is currently connected.

    or addListener(GoogleApiClient client, NodeApi.NodeListener listener) which

    Registers a listener to receive all node events.

    Then you can use callbacks from NodeApi.NodeListener

    onPeerConnected(Node peer) and onPeerDisconnected(Node peer)
    

提交回复
热议问题