내가 블루투스 연결을 설정하는 코드를 사용하고 있습니다에 잘,안드로이드 블루투스 코드 작업 2.2이 아닌 2.3 또는 2.3.3
public void run()
{
try
{
Method m = mBluetoothDevice.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
mBluetoothSocket = (BluetoothSocket) m.invoke(mBluetoothDevice, 1);
// mBluetoothSocket = mBluetoothDevice.createRfcommSocketToServiceRecord(applicationUUID);
mBluetoothAdapter.cancelDiscovery();
mBluetoothSocket.connect();
}
catch (IOException eConnectException)
{
Log.d(TAG, "CouldNotConnectToSocket", eConnectException);
closeSocket(mBluetoothSocket);
return;
} catch (SecurityException e) {
Log.d(TAG, "CouldNotConnectToSocket", e);
closeSocket(mBluetoothSocket);
} catch (NoSuchMethodException e) {
Log.d(TAG, "CouldNotConnectToSocket", e);
closeSocket(mBluetoothSocket);
} catch (IllegalArgumentException e) {
Log.d(TAG, "CouldNotConnectToSocket", e);
closeSocket(mBluetoothSocket);
} catch (IllegalAccessException e) {
Log.d(TAG, "CouldNotConnectToSocket", e);
closeSocket(mBluetoothSocket);
} catch (InvocationTargetException e) {
Log.d(TAG, "CouldNotConnectToSocket", e);
closeSocket(mBluetoothSocket);
}
}
은 2.2 안드로이드 인 Karbonn 장치에서 잘 작동
때 내가 시도 삼성 전자 갤럭시 Y와 소니 에릭슨 Xperia 미니에 동일한 코드가 작동하지 않습니다 ... 문제가 될 수 있습니다. 친절하게 ...
정교한 오류 로그로 "작동하지 않음"... – waqaslam
오류가없고 10-12 초 후 ACTION_ACL_DISCONNECTED 이벤트가 발생했습니다 ... – Sandeep