简体   繁体   English

Android自动蓝牙连接

[英]Android automatic Bluetooth connection

When I turn on Bluetooth on my Android device and my Bluetooth speaker is in range, the phone automatically connects to the speaker, without me doing anything other that turning on Bluetooth. 当我在Android设备上打开蓝牙并且蓝牙扬声器处于有效范围内时,手机会自动连接到扬声器,而无需执行其他任何操作即可打开蓝牙。

I want to be able to do this with a Bluetooth module I am using in my Arduino Project. 我希望能够使用我在Arduino项目中使用的蓝牙模块来做到这一点。 I wasn't able to find anything on that topic, but if my Chinese speaker does it, surely there must be a way mimic this behaviour. 我无法找到关于该主题的任何信息,但是如果我的中文发言人做到了,那么肯定有一种模仿这种行为的方法。

My project involves Arduino, HC-05 module, and an android app. 我的项目涉及Arduino,HC-05模块和一个Android应用程序。 For now the connection is initiated with a button click inside the app. 现在,通过在应用程序内部单击按钮来启动连接。 Is there a way to auto connect to the module before even starting an app? 是否可以在启动应用程序之前自动连接到模块? You connect to it, just by turning on Bluetooth on your device. 您只需打开设备上的蓝牙即可连接到它。

Record the physical address of your peripheral and start a connection each time you discover that particual address. 记录外围设备的物理地址,并在每次发现该特定地址时启动连接。 Programatically, that's all you can do. 以编程方式,这就是您所能做的。 Else, you would have to do it manually from your Bluetooth settings. 否则,您将必须通过蓝牙设置手动进行操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM