2011-03-23 111 views
2

有沒有什麼辦法可以獲得BT發現設備的服務名稱。我的藍牙發現LOGIS如下安卓藍牙服務名稱

startdiscovery() 
{ 

    boolean status1 = mBluetoothAdapter.startDiscovery(); 

} 

BroadcastReceiver mReceiver = new BroadcastReceiver() 
    { 
    if (BluetoothDevice.ACTION_FOUND.equals(action)) 
     {   


if(intent.hasExtra(BluetoothDevice.EXTRA_DEVICE)) 
      { 
      BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);  

          } 
        } 
    } 

在這裏,我知道字符串格式中發現的設備的只有「服務名稱」。

bluetoothclass.hasService(int) - 此API將預定義的SERVICE NAMES作爲輸入參數並返回TRUE/FALSE。我可以使用這個API,因爲我只知道服務名稱。

回答