언어 설정

Menu
Sites
Language
기어 매니저와 기어(Watch)의 현재 연결 상태를 확인하는 방법 문의

Host에서 SAP 와 상관없이 기어 연결 상태를 체크하고 싶은데요..

Accessory SDK 사용 하지 않고도 Host(android)  기어 매니저와 기어(Watch) 현재 연결(pairing) 상태인지를 확인이 가능한 방법이 있을까요?

Responses

1 댓글
daniel kim

안녕하세요..

Gear가 Phone과 bluetooth로 연결되기 때문에 아래와 같이 paired된 device를 phone단에서 search하시면 될 것 같습니다. 

 

      http://developer.android.com/guide/topics/connectivity/bluetooth.html

 

Querying paired devices

Before performing device discovery, its worth querying the set of paired devices to see if the desired device is already known. To do so, call getBondedDevices(). This will return a Set of BluetoothDevices representing paired devices. For example, you can query all paired devices and then show the name of each device to the user, using an ArrayAdapter:
 
Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
// If there are paired devices
if (pairedDevices.size() > 0) {
    // Loop through paired devices
    for (BluetoothDevice device : pairedDevices) {
        // Add the name and address to an array adapter to show in a ListView
        mArrayAdapter.add(device.getName() + "\n" + device.getAddress());
    }
}

All that's needed from the BluetoothDevice object in order to initiate a connection is the MAC address. In this example, it's saved as a part of an ArrayAdapter that's shown to the user. The MAC address can later be extracted in order to initiate the connection. You can learn more about creating a connection in the section about Connecting Devices.