title: How to connect to OBDII via Android Bluetooth
body: <p>Currently I've been using this reference <a href="http://blog.lemberg.co.uk/how-guide-obdii-reader-app-development" rel="nofollow noreferrer">http://blog.lemberg.co.uk/how-guide-obdii-reader-app-development</a> but I am still confused on what the next steps are for my Android app to be able to connect to the OBDII. I found code online for a simple bluetooth app. The app is able to form bluetooth connections with other Android phones but not with the OBDII.</p>
  
  <pre><code>public class MainActivity extends Activity {
  
  Button b1,b2,b3,b4;
  private BluetoothAdapter BA;
  private Set&lt;BluetoothDevice&gt;pairedDevices;
  ListView lv;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      b1 = (Button) findViewById(R.id.button);
      b2=(Button)findViewById(R.id.button2);
      b3=(Button)findViewById(R.id.button3);
      b4=(Button)findViewById(R.id.button4);
  
      BA = BluetoothAdapter.getDefaultAdapter();
      lv = (ListView)findViewById(R.id.listView);
  }
  
  public void on(View v) {
      if (!BA.isEnabled()) {
          Intent turnOn = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
          startActivityForResult(turnOn, 0);
          Toast.makeText(getApplicationContext(), "Turned on", Toast.LENGTH_LONG).show();
      } else {
          Toast.makeText(getApplicationContext(), "Already on", Toast.LENGTH_LONG).show();
      }
  }
  
  public void off(View v) {
      BA.disable();
      Toast.makeText(getApplicationContext(), "Turned off", Toast.LENGTH_LONG).show();
  }
  
  public void visible(View v) {
      Intent getVisible = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
      startActivityForResult(getVisible, 0);
  }
  
  public void list(View v) {
      pairedDevices = BA.getBondedDevices();
  
      ArrayList list = new ArrayList();
  
      for (BluetoothDevice bt : pairedDevices) list.add(bt.getName());
      Toast.makeText(getApplicationContext(), "Showing Paired Devices", Toast.LENGTH_SHORT).show();
  
      final ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, list);
  
      lv.setAdapter(adapter);
  }
  </code></pre>
  
  <p>Moving forward, what must be done in order for the app to be able to successfully establish and maintain a bluetooth connection with the OBDII. </p>