我的Android应用程序连接蓝牙设备作为客户端.
第一次尝试:设备连接并关闭应用程序,套接字和iostreams关闭.
第二次尝试:设备没有连接,但我得到连接的吐司.没有例外.
关闭蓝牙设备然后再打开,使设备连接并且问题仍然存在
public class ConnectingThread extends Thread{
private ImageView connect;
private Context context;
private final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
private BluetoothAdapter mmAdapter;
public static BluetoothSocket mmSocket ;
private InputStream mmInStream ;
private OutputStream mmOutStream ;
private VibrotacDevice device;
public ConnectingThread(BluetoothDevice device, Context context, BluetoothAdapter adapter ) {
mmAdapter=adapter;
// connect=(ImageView) ((Activity)context).findViewById(R.id.connectionimg);
this.context=context;
BluetoothSocket tmp = null;
// Get a BluetoothSocket to connect with the given BluetoothDevice
try {
// MY_UUID is the app's UUID string, also used by …Run Code Online (Sandbox Code Playgroud)