I managed to get a BluetoothHDP sample, but I had to connect the phone and UA-767PBT-C and add the following code:
else if (prevState == BluetoothHealth.STATE_CHANNEL_CONNECTING && newState == BluetoothHealth.STATE_CHANNEL_CONNECTED) { if (config.equals(mHealthAppConfig)) { mChannelId = channelId; sendMessage(STATUS_CREATE_CHANNEL, RESULT_OK); (new ReadThread(fd)).start(); } else { sendMessage(STATUS_CREATE_CHANNEL, RESULT_FAIL); }
to BluetoothHDPService.onHealthChannelStateChange() .
After that, I collected code that I could use from the sample, and changed it to fit my program.
source share