Created
August 28, 2019 23:45
-
-
Save rohanmendon/a3c673859e02c3f33f27e4876265f13c to your computer and use it in GitHub Desktop.
Creating an instance of the paired OBDII device
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.bluetooth.BluetoothAdapter; | |
import android.bluetooth.BluetoothDevice; | |
private static String OBD2_DEVICE_NAME = "OBDII"; // Name of the Device shipped by the manufacturer | |
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); | |
Set<BluetoothDevice> bondedDevices = mBluetoothAdapter.getBondedDevices(); | |
BluetoothDevice obd2Device; | |
for(BluetoothDevice bondedDevice: bondedDevices) { | |
if (bondedDevice.getName().contains(OBD2_DEVICE_NAME)) { | |
obd2Device = bondedDevice; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment