【问题标题】:Detect Glass paired with phone检测与手机配对的 Glass
【发布时间】:2014-04-18 18:17:32
【问题描述】:

我有一个 Android“伴侣”应用程序,它在 Glass 所连接的手机上运行,​​并与 Glass 上运行的 GDK 应用程序对话。我正在寻找一种方法来确定(以编程方式,从手机端)给定的蓝牙配对是否与 Glass 配对。

我想出的唯一办法是检查设备名称中是否包含“Glass”一词 - 因为,AFAIK,Glass 为自己分配的默认设备名称总是如此,而且我知道没有 UI更改。但这很牛逼。有更好的想法吗?

【问题讨论】:

    标签: android bluetooth google-glass google-gdk


    【解决方案1】:

    我认为您可以从 BluetoothAdapter.getDefaultAdapter().getBondedDevices() 遍历服务 uuid 列表,然后检查 Glass uuid。

    Set<BluetoothDevice> devices = BluetoothAdapter.getDefaultAdapter().getBondedDevices();
    BluetoothDevice glass = null;
    for (BluetoothDevice d : devices {
        ParcelUuid[] uuids = d.getUuids();
            for (ParcelUuid p : uuids) {
               System.out.println(p.getUuid().toString());
               if (p.getUuid().toString().equals("fafbdd20-83f0-4389-addf-917ac9dae5b1")) {
                      //found in the GlassHome.apk for XE16.  
                     glass = d;
                     break;
               }
              //NOTE: you may need to adjust this UIUD.
            }
         if (glass != null) { break; }
    }
    if (glass != null) {
       if (glass.getBondState().equals(BOND_BONDED) {
          //This last check makes sure you are through the pairing process.
    
       }
    }
    

    【讨论】:

    • 在我的设备更新到 16.1 之前,我没有机会在 XE16 上对此进行测试,但它在那里不起作用。我的 Glass 有 5 个 UIUD,没有一个在这里检查。
    猜你喜欢
    • 1970-01-01
    • 2012-10-11
    • 1970-01-01
    • 2012-03-20
    • 1970-01-01
    • 2020-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多