Android - 从 Smart Phone 获取 Android 可穿戴设备的 Android ID
Android - Getting Android ID of Android Wearable Device from Smart Phone
有没有办法获取与我的智能 phone 配对的 Android 可穿戴设备的 Android ID?我在智能 phone 上安装了我的应用程序 运行,但在 android 可穿戴设备(例如手表)上没有应用程序 运行。
据我了解,Android 可穿戴设备和智能 phone 将通过蓝牙配对。我查看了所有蓝牙 API (http://developer.android.com/guide/topics/connectivity/bluetooth.html) and the closest thing I can get to an ID is the UUID which isn't the Android ID (http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#getUuids())
谢谢!
J
这是可能的。您需要在手持设备上使用NodeApi
,通过getConnectedNodes
获取连接的节点。它 returns NodeApi.GetConnectedNodesResult
的一个实例。通过此对象,您可以检索所有已连接节点的列表。例如
Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).setResultCallback(new ResultCallback<NodeApi.GetConnectedNodesResult>() {
@Override
public void onResult(NodeApi.GetConnectedNodesResult getConnectedNodesResult) {
for (Node node : getConnectedNodesResult.getNodes()) {
Log.i(LOG_TAG, "node id " + node.getId());
}
}
});
有没有办法获取与我的智能 phone 配对的 Android 可穿戴设备的 Android ID?我在智能 phone 上安装了我的应用程序 运行,但在 android 可穿戴设备(例如手表)上没有应用程序 运行。
据我了解,Android 可穿戴设备和智能 phone 将通过蓝牙配对。我查看了所有蓝牙 API (http://developer.android.com/guide/topics/connectivity/bluetooth.html) and the closest thing I can get to an ID is the UUID which isn't the Android ID (http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#getUuids())
谢谢! J
这是可能的。您需要在手持设备上使用NodeApi
,通过getConnectedNodes
获取连接的节点。它 returns NodeApi.GetConnectedNodesResult
的一个实例。通过此对象,您可以检索所有已连接节点的列表。例如
Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).setResultCallback(new ResultCallback<NodeApi.GetConnectedNodesResult>() {
@Override
public void onResult(NodeApi.GetConnectedNodesResult getConnectedNodesResult) {
for (Node node : getConnectedNodesResult.getNodes()) {
Log.i(LOG_TAG, "node id " + node.getId());
}
}
});