I would like to retrieve the name of the wear device connected, as "Gear Live 02xx".
Can I use the wear API to achieve this?
Using this:
node.getDisplayName();
I receive a String as 4750237895-4553-4343-xxxxxxxxxxxxx.
If you're having issues connecting your watch and phone, please begin by making sure that your phone's OS version is compatible (Android 6.0+ and iOS 10.0+) and that the Wear OS by Google app is up-to-date. Then, check if you have activated Bluetooth on your phone, disable, and re-enable it.
Why not using bluetooth api? http://developer.android.com/guide/topics/connectivity/bluetooth.html#QueryingPairedDevices
the API description is not so clear: a human readable description of the node. Sometimes generated from the bluetooth device name
"Sometimes" is not that good explanation... converting your string Hex2ASCII seems like:
GP#xESCC and too far from Gear Live name...
I used this for the convertion: http://www.rapidtables.com/convert/number/hex-to-ascii.htm
There is no official API to retrieve the name of the wearable device that is shown when the watch is first booted, such as G WATCH 1234 or MOTO 360 1234.
This may change in the future, but if you want to get a similar name right now, you need to do something like this:
BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
String btAddress = "No Bluetooth";
if (btAdapter != null)
btAddress = btAdapter.getAddress();
// Reconstitute the pairing device name from the model and the last 4 digits of the bluetooth MAC
String wearName;
if ((btAddress != null) && (!btAddress.equals("No Bluetooth"))) {
wearName = android.os.Build.MODEL;
String[] tokens = btAddress.split(":");
wearName += " " + tokens[4] + tokens[5];
wearName = wearName.toUpperCase();
} else {
wearName = "No Bluetooth";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With