Android empairelhando dispositivos bluetooth sem dialog com pino

Eu quero empairelhair meu celulair Android e SPP bluetooth sem dialog com pin e confirmação. Eu tenho esse código, registre BroadcastReceiview :

 IntentFilter filter = new IntentFilter(ACTION_PAIRING_REQUEST); registerReceiview(mPairReceiview, filter); pairDevice(device); 

Método PairDevice :

  • Android: printing Bluetooth
  • Como fazer o telefone Android como um fone de ouvido bluetooth?
  • BluetoothAdapter ActionDiscoviewyFinished
  • Envio de files Android Bluetooth
  • Android - Descoberta Bluetooth não encontra nenhum dispositivo
  • O código de exemplo da API Bluetooth OBD-II do Android não está funcionando
  •   private void pairDevice(BluetoothDevice device) { try { Method method = device.getClass().getMethod("createBond", (Class[]) null); method.invoke(device, (Object[]) null); } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) {  private void pairDevice(BluetoothDevice device) { try { Method method = device.getClass().getMethod("createBond", (Class[]) null); method.invoke(device, (Object[]) null); } catch (Exception e) { e.printStackTrace(); } } }  private void pairDevice(BluetoothDevice device) { try { Method method = device.getClass().getMethod("createBond", (Class[]) null); method.invoke(device, (Object[]) null); } catch (Exception e) { e.printStackTrace(); } } 

    BroadcastReceiview :

     private final BroadcastReceiview mPairReceiview = new BroadcastReceiview() { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (ACTION_PAIRING_REQUEST.equals(action)) { System.out.println("ACTION_PAIRING_REQUEST"); setBluetoothPairingPin(device); } } }; } private final BroadcastReceiview mPairReceiview = new BroadcastReceiview() { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (ACTION_PAIRING_REQUEST.equals(action)) { System.out.println("ACTION_PAIRING_REQUEST"); setBluetoothPairingPin(device); } } }; } private final BroadcastReceiview mPairReceiview = new BroadcastReceiview() { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (ACTION_PAIRING_REQUEST.equals(action)) { System.out.println("ACTION_PAIRING_REQUEST"); setBluetoothPairingPin(device); } } }; 

    Método SetBluetoothPairingPin :

     public void setBluetoothPairingPin(BluetoothDevice device) { byte[] pinBytes = conviewtPinToBytes("0000"); try { Log.d(TAG, "Try to set the PIN"); Method m = device.getClass().getMethod("setPin", byte[].class); m.invoke(device, pinBytes); Log.d(TAG, "Success to add the PIN."); try { device.getClass().getMethod("setPairingConfirmation", boolean.class).invoke(device, false); Log.d(TAG, "Success to setPairingConfirmation."); } catch (Exception e) { // TODO Auto-generated catch block Log.e(TAG, e.getMessage()); e.printStackTrace(); } } catch (Exception e) { Log.e(TAG, e.getMessage()); e.printStackTrace(); } } { public void setBluetoothPairingPin(BluetoothDevice device) { byte[] pinBytes = conviewtPinToBytes("0000"); try { Log.d(TAG, "Try to set the PIN"); Method m = device.getClass().getMethod("setPin", byte[].class); m.invoke(device, pinBytes); Log.d(TAG, "Success to add the PIN."); try { device.getClass().getMethod("setPairingConfirmation", boolean.class).invoke(device, false); Log.d(TAG, "Success to setPairingConfirmation."); } catch (Exception e) { // TODO Auto-generated catch block Log.e(TAG, e.getMessage()); e.printStackTrace(); } } catch (Exception e) { Log.e(TAG, e.getMessage()); e.printStackTrace(); } } } catch (Exception e) { public void setBluetoothPairingPin(BluetoothDevice device) { byte[] pinBytes = conviewtPinToBytes("0000"); try { Log.d(TAG, "Try to set the PIN"); Method m = device.getClass().getMethod("setPin", byte[].class); m.invoke(device, pinBytes); Log.d(TAG, "Success to add the PIN."); try { device.getClass().getMethod("setPairingConfirmation", boolean.class).invoke(device, false); Log.d(TAG, "Success to setPairingConfirmation."); } catch (Exception e) { // TODO Auto-generated catch block Log.e(TAG, e.getMessage()); e.printStackTrace(); } } catch (Exception e) { Log.e(TAG, e.getMessage()); e.printStackTrace(); } } } public void setBluetoothPairingPin(BluetoothDevice device) { byte[] pinBytes = conviewtPinToBytes("0000"); try { Log.d(TAG, "Try to set the PIN"); Method m = device.getClass().getMethod("setPin", byte[].class); m.invoke(device, pinBytes); Log.d(TAG, "Success to add the PIN."); try { device.getClass().getMethod("setPairingConfirmation", boolean.class).invoke(device, false); Log.d(TAG, "Success to setPairingConfirmation."); } catch (Exception e) { // TODO Auto-generated catch block Log.e(TAG, e.getMessage()); e.printStackTrace(); } } catch (Exception e) { Log.e(TAG, e.getMessage()); e.printStackTrace(); } } } catch (Exception e) { public void setBluetoothPairingPin(BluetoothDevice device) { byte[] pinBytes = conviewtPinToBytes("0000"); try { Log.d(TAG, "Try to set the PIN"); Method m = device.getClass().getMethod("setPin", byte[].class); m.invoke(device, pinBytes); Log.d(TAG, "Success to add the PIN."); try { device.getClass().getMethod("setPairingConfirmation", boolean.class).invoke(device, false); Log.d(TAG, "Success to setPairingConfirmation."); } catch (Exception e) { // TODO Auto-generated catch block Log.e(TAG, e.getMessage()); e.printStackTrace(); } } catch (Exception e) { Log.e(TAG, e.getMessage()); e.printStackTrace(); } } } public void setBluetoothPairingPin(BluetoothDevice device) { byte[] pinBytes = conviewtPinToBytes("0000"); try { Log.d(TAG, "Try to set the PIN"); Method m = device.getClass().getMethod("setPin", byte[].class); m.invoke(device, pinBytes); Log.d(TAG, "Success to add the PIN."); try { device.getClass().getMethod("setPairingConfirmation", boolean.class).invoke(device, false); Log.d(TAG, "Success to setPairingConfirmation."); } catch (Exception e) { // TODO Auto-generated catch block Log.e(TAG, e.getMessage()); e.printStackTrace(); } } catch (Exception e) { Log.e(TAG, e.getMessage()); e.printStackTrace(); } } 

    mas sempre mostra dialog com pin e confirmação.

  • Problema de connection Android Bluetooth LE
  • Kit de desenvolvimento BTLE (Bluetooth Low Energy) - deve ter um perfil de proximidade
  • Enviando um file usando Bluetooth OBEX Object Push Profile (OPP)
  • Como descobrir se o dispositivo Android suporta Bluetooth Low Energy
  • Verifique se o SPP UUID 00001101-0000-1000-8000-00805F9B34FB existe no server
  • BluetoothAdapter.getDefaultAdapter () jogando RuntimeException enquanto não estiview na atividade
  • Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.