Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving the name of wear device

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.

like image 945
Gabriele Mariotti Avatar asked Oct 16 '14 08:10

Gabriele Mariotti


People also ask

Why won't My wear OS watch connect to my phone?

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.


2 Answers

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

like image 99
N Dorigatti Avatar answered Sep 28 '22 09:09

N Dorigatti


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";
    }
like image 41
Wayne Piekarski Avatar answered Sep 28 '22 08:09

Wayne Piekarski