Detect when wearable connected/disconnected to/from Android phone

前端 未结 3 1486
没有蜡笔的小新
没有蜡笔的小新 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:25

    As akmal said you can get devices which are connected to the phone, But to know whether the wearable currently connected with handheld

    List connectedNodes =
        Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).await().getNodes();
    

    The list contains data like this:

    Node{Moto 360 6BBF, id=3b6d19bf, hops=1, isNearby=true}
    

提交回复
热议问题