Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Conection()
- {
- // try {
- BluetoothDevice device = btAdapter.getRemoteDevice(MacAddress);
- Log.d(LOG_TAG, "***Получили удаленный Device***" + device.getName());
- try {
- btSocket = device.createRfcommSocketToServiceRecord(MY_UUID);
- Log.d(LOG_TAG, "...Создали сокет...");
- } catch (IOException e) {
- }
- btAdapter.cancelDiscovery();
- Log.d(LOG_TAG, "***Отменили поиск других устройств***");
- Log.d(LOG_TAG, "***Соединяемся...***");
- try {
- btSocket.connect();
- try {
- Intent intentErrorSertch = new Intent(ErrorSertch.this, Home.class);
- startActivity(intentErrorSertch);
- } catch (Exception e) {
- }
- Log.d(LOG_TAG, "***Соединение успешно установлено***");
- } catch (IOException e) {
- try {
- btSocket.close();
- bat.setVisibility(View.VISIBLE);
- } catch (IOException e2) {
- }
- }
Add Comment
Please, Sign In to add comment