我已经尝试了其他评论中的所有建议,但都没有效果,我希望有人能帮助我。我已经为这个问题挣扎了三天了。我确信我的uuid是正确的,并且我知道清单中启用了蓝牙访问。
我正在尝试将我的android应用程序连接到运行在Fedora中的python服务器。它断断续续地工作,现在一点也不起作用。我收到的android异常通常是。。当在下面附加的代码中执行btSocket.connect()时,将抛出这些值。12-09 05:08:42.331: ERROR/BluetoothService(676): java.io.IOException: Service discovery failed
或者12-09 05:27:00.757: ERROR/BluetoothService(729): java.io.IOException: Service discovery failed
这是我的android蓝牙课程,应该负责一切。当主应用程序类收到套接字已连接到的消息时,线程将启动。我的蓝牙类基于http://www.anddev.org/viewtopic.php?p=35487#35487。package spin.halo;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.UUID;
import android.bluetooth.*;
import android.os.Handler;
import android.util.Log;
public class BluetoothService extends Thread{
private static final String TAG = "BluetoothService";
private static final boolean D = true;
private BluetoothAdapter mBluetoothAdapter = null;
private BluetoothSocket btSocket = null;
private OutputStream outStream = null;
private InputStream inStream = null;