Я разрабатываю приложение, в котором хочу подключить основную проблему устройства Bluetooth. Я не хочу, чтобы пользователь вводил требуемый PIN-код, вместо этого приложение должно делать это самостоятельно... У меня нет какой-либо связанной проблемы..Просто хотите вставить и завершить процедуру проверки подлинности с помощью самого приложения.
Я нашел следующий код, я уверен, что он работает, но не уверен, как добавить pin в этот код.
private void pairDevice(BluetoothDevice device) {
try {
Log.d("pairDevice()", "Start Pairing...");
Method m = device.getClass().getMethod("createBond", (Class[]) null);
m.invoke(device, (Object[]) null);
Log.d("pairDevice()", "Pairing finished.");
} catch (Exception e) {
Log.e("pairDevice()", e.getMessage());
}
}
Кто-нибудь знает, как вводить PIN-код в код выше или какой-либо аналогичный код для решения проблемы. Благодарю вас.