How to Auto-Connect to Arduino with Android App?

1.6k Views Asked by At

I am currently working on an android application that blocks texting while driving. It connects through Bluetooth to an Arduino Bluno that is connected to a car via the OBD-II port and scans for data received from a car (either 0 for a non-drive state or 1 if the car is going above 0 mph i.e. driving) and blocks texting if the car is in a drive state.

What I would like to do is have the app/phone automatically connect to the Arduino once I enter the car with the phone and start driving. I am not familiar with how to do so, if I need to use the native Android Bluetooth connection data to scan for the hardware or if there is some other approach. Can I get some guidance as to how I can auto-connect?

1

There are 1 best solutions below

2
On

Once the device is paired you can initialize the communication with your app or Arduino at any point.

So in your case I believe the best way would be to let the arduino initialize the communication with the app once you detect the car starts driving. The phone would have no idea when that happens according to the setup you described above.

To get an idea of how to use Bluetooth in your app (as always) you should have a look at the Android developer website.

Here are some links to get you started: