2

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 Answers1

0

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:

YKa
  • 3,998
  • 4
  • 20
  • 31
  • I can already communicate between the phone and Arduino, sorry if I did not make that clear. From the app, I have the option of scanning for and connecting to the Arduino with Bluetooth. What I would like is to connect automatically to the Arduino as soon as the user starts driving. Great points though! So I should create a socket in the app that listens to the Arduino signal? That way, I won't have to connect to it via scan? – user3482978 Apr 02 '14 at 01:39
  • If I understand what you are trying to do then listening to the Arduino over the socket would definitely be one possible solution. – YKa Apr 02 '14 at 02:48