android-bluetooth

Connect to specific Bluetooth device with a click

夙愿已清 提交于 2019-12-22 01:18:19
问题 I'm trying to connect to a specific device using my Android APP, until now what I was able to do is get the paired items doing this : BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); Set < BluetoothDevice > pairedDevices = bluetoothAdapter.getBondedDevices(); if (pairedDevices.size() > 0) { for (BluetoothDevice device: pairedDevices) { mDeviceName.add(device.getName()); mDeviceMAC.add(device.getAddress()); } } bluetoothClass.setDeviceName(mDeviceName); bluetoothClass

How can i use the Bluetooth HID Device profile in Android Pie?

自作多情 提交于 2019-12-21 12:16:33
问题 I am trying to write an app for Android P using the Bluetooth HID device profile service to be used as a Bluetooth keyboard. According to the documentation I am supposed to use the method BluetoothAdapter.getProfileProxy(Context, BluetoothProfile.ServiceListener, int) to get the BluetoothHidDevice proxy object. During debug on my Android Pie device (Nokia 7 plus) the service listener never get called ( onServiceConnected ), and i get the following error in Logcat: Could not bind to Bluetooth

Android Bluetooth : get Device Specific AT commands

风格不统一 提交于 2019-12-21 05:02:43
问题 I am using " android.bluetooth.headset.action.VENDOR_SPECIFIC_HEADSET_EVENT " intent to get device specific AT commands. But the broadcastreciever didn't fire when I send AT command from MY Bluetooth Kit. When I send AT+CHUP\r from my kit the android work on this command internally and disconnects the call. But when I send AT+XEVENT=foo,3\r from kit but I am not getting any thing in receiver. Help me out 回答1: I also had a hard time getting the vendor specific headset event to work, but

Device Bluetooth address in Oreo (8.1)

倖福魔咒の 提交于 2019-12-21 02:58:06
问题 I need to obtain device's Bluetooth MAC address. Before Android 6 it was easy as BluetoothAdapter.getDefaultAdapter().getAddress() . After that we had to use a simple workaround: String macAddress = android.provider.Settings.Secure.getString(context.getContentResolver(), "bluetooth_address"); . But later(in Android 8 AFAIK) it was also closed, but another workaround was discovered: BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); String bluetoothMacAddress = ""; if

Using Microhip's MLDP data streaming from Android or iOS

♀尐吖头ヾ 提交于 2019-12-21 02:26:11
问题 Microchip defined a way to stream data over BlueTooth low energy (BLE) and called it MLDP (Microchip Low-energy Data Profile). They built it into their RN4020 chip, and there is even an sample Android app. However, I can't find any specification of how the protocol works or source for the app. I'd like to be able to use it to debug an embedded device from Android and/or iOS. Does anyone know the specification for this protocol or software that implements it? 回答1: Hi i was in the same problem,

Robustly communicating with multiple BLE devices simultaneously on Android

故事扮演 提交于 2019-12-20 17:42:08
问题 Although undocumented, conventional wisdom using the Android BLE apis is that certain operations like reading / writing Characteristics & Descriptors should be done one at a time (although some devices are more lenient than others). However, I am not clear on whether this policy should apply only to a single connection, or across all active connections. I've heard that its best to initiate connections to devices one at a time. That might be an example of operations (connect / connectGatt)

Print Pdf file via Bluetooth Printer Android

霸气de小男生 提交于 2019-12-20 17:28:04
问题 In My project Need to print Pdf file Via Bluetooth Printer. I write a code to print via pdf Its for fine for a Text, But I want to Print PDF file on Bluetooth printer. My java Code to Print Text @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); lv= (ListView) findViewById(R.id.listView1); // listdata(lv); try { // we are goin to have three buttons for specific functions Button openButton = (Button)

Print Pdf file via Bluetooth Printer Android

こ雲淡風輕ζ 提交于 2019-12-20 17:27:37
问题 In My project Need to print Pdf file Via Bluetooth Printer. I write a code to print via pdf Its for fine for a Text, But I want to Print PDF file on Bluetooth printer. My java Code to Print Text @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); lv= (ListView) findViewById(R.id.listView1); // listdata(lv); try { // we are goin to have three buttons for specific functions Button openButton = (Button)

Android BLE GATT_ERROR(133) on connecting to device

自古美人都是妖i 提交于 2019-12-20 10:49:11
问题 I am trying to connect to a BLE device using the MAC address. BluetoothDevice device = bluetoothAdapter.getRemoteDevice(rememberedDeviceAddress) bluetoothDevice.connectGatt(context, false, bluetoothGattCallback); I get a callback in BluetoothGattCallback.onConnectionStateChange with status = 133 and newState = 2 even when my BLE device is switched off. newState = 2 refers to BluetoothProfile.STATE_CONNECTED which means that i am connected to the device and status = 133 is GATT_ERROR (instead

How to Send an Audio HEX file to Ble Device

馋奶兔 提交于 2019-12-19 11:45:20
问题 I have a working ble device with android . it sends and receives data finely through the Android app. But Now My Problem is I want to send Some Audio HEX files to my BLE Device. And its larger Than 20 bytes. How Can i send such a data to a BLE Device. ?? 回答1: For send data upper than 20bytes, you need to change the MTU-exchange. To API LEVEL 21, you can use requestMtu (Android Developer), it negotiates with the peripherical device and you can define until 512 bytes. The MTU value is defined