如何检测Android 2.2+上的免提附件?
我想知道用户何时连接免提配件,并且没有阻止呼叫\短信。是否有可能知道它何时通过硬件端口或蓝牙连接?如何检测Android 2.2+上的免提附件?
回答:
在您的onCreate或onResume尝试此操作。
BluetoothAdapter myLocalAdapter = BluetoothAdapter.getDefaultAdapter(); BluetoothDevice garniture;
Set<BluetoothDevice> connectedDevices = myLocalAdapter.getBondedDevices();
for (BluetoothDevice device : connectedDevices){
String name = device.getName();
//... check for the name you want
if(name.equals("whatnameisit"){
garniture = device
}
}
if (garniture != null){
// yay we found it, lets do our work with the device here
}
以上是 如何检测Android 2.2+上的免提附件? 的全部内容, 来源链接: utcz.com/qa/265915.html