如何配对蓝牙设备编程机器人 [英] How to pair Bluetooth device programmatically Android

查看:147
本文介绍了如何配对蓝牙设备编程机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发展,我想连接的蓝牙设备的主要问题是,我不希望用户输入所需的引脚,而不是应用程序应该做到这一点的自己......我没有任何连接相关的问题的应用程序.. 。只有希望通过应用程序本身插入和完整的引脚验证过程。

I am developing an application where I want to connect a Bluetooth device main issue is I don't want user to enter required pin instead application should do that by himself...I don't have any connection related issue...Only want to insert and complete pin authentication process by application itself.

我发现下面code我相信这是工作,但不知道如何添加脚本code ??

I found following code I am sure it is working but not sure on how to add pin in this code??

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());
        }
    }

有谁知道如何在上述code或任何类似code,以解决问题进入销.. 谢谢

Does anyone know how to enter pin in above code or any similar code to solve problem.. Thank You

推荐答案

<一个href="http://stackoverflow.com/questions/7337032/how-can-i-avoid-or-dismiss-androids-bluetooth-pairing-notification-when-i-am-do">How我能避免或者解聘Android的蓝牙配对通知,当我在做方案的配对?

这似乎给你答案,与销进入和所有。它包括发送.setPin()时,你得到的消息。

This seems to give you the answer, with the pin entering and all. It involves sending .setPin() whenever you get the message.

这篇关于如何配对蓝牙设备编程机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆