연결이 설정된 직후 장치에서 연결을 끊는 방법은 무엇입니까? 나는 블랙리스트 장치Android에서 Bluetooth를 통한 데이터 교환을 방지하는 방법
public class BluetoothReceiver extends BroadcastReceiver {
if (action.equals(BluetoothDevice.ACTION_ACL_CONNECTED)) {
BluetoothDevice remoteDevice = (BluetoothDevice) intent.getExtras().get(BluetoothDevice.EXTRA_DEVICE);
// I'd like to disconnect from remoteDevice here
}
}
당신이 mBluetoothGatt 정의 후 AndroidManifest.xml을
<receiver android:name="com.app.receivers.BluetoothReceiver" >
<intent-filter>
<action android:name="android.bluetooth.device.action.ACL_CONNECTED" />
</intent-filter>
</receiver>
'BluetoothGattCallback'에는'disconnect() '라는 메소드가 없습니다. http://developer.android.com/reference/android/bluetooth/BluetoothGattCallback.html. 그리고 귀하의 코드는 [Bluetooth Low Energy] (http://developer.android.com/guide/topics/connectivity/bluetooth-le.html)에 관한 것입니다. 제 질문은 태블릿, 전화 등과 같은 일반 장치에서 연결을 끊는 것입니다. –