FAQ Database Discussion Community


How can I clear the buffer?

android,android-bluetooth,bytebuffer
I have written a class which can recieve texts from the Bluetooth Serial Port, but when I sent “a” it toast “akkk” after I sent “kkkk” it toast “kkkk”, why should it's result beyound the consideration?What should I do to make it toast “a”?Can I clear the buffer, and how?...

ClassCast Exception Error

android,bluetooth-lowenergy,classcastexception,android-bluetooth
When I am trying to use Application object for maintain bluetooth service in whole android app, My application throw me Classcast Exception. When I am trying to connect bluetooth Peripheral. 04-27 09:11:37.704 3289-3289/com.xemodex.bluetooth.xemodex E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.xemodex.bluetooth.xemodex, PID: 3289 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xemodex.bluetooth.xemodex/com.xemodex.bluetooth.xemodex.DeviceControlActivity}: java.lang.ClassCastException: android.app.Application...

Start bluetooth adapter without pop up

java,android,bluetooth,android-bluetooth
How can we start the bluetooth adapter in background without the validation popup ? normal way : Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); context.startActivityForResult(enableBtIntent, 1); context.sendBroadcast(enableBtIntent); ...

Audio track not working through Bluetooth in Samsung S6

android,android-bluetooth,android-audiomanager,android-audiorecord
I am recording audio using AudioRecord and playing using AudioTrack. I am recording Fm analog audio stream using this classes and simultaneously passing into Bluetooth router. Its successfully working with Motorola and Samsung S5. But not working with Samsung Galaxy S6. This is the sample code how i am recording...

Is Android BluetoothLE support two way communication between glass and mobile?

android,bluetooth,bluetooth-lowenergy,android-bluetooth
My Google Glass and Mobile supports Bluetooth LE.Can I use the Bluetooth LE for two way communication between Glass and mobile.I try to send an image from Glass to mobile and again send response to Glass using bluetooth LE.Is it possible to do this?

Bluetooth HCI snoop log not generated

android,bluetooth,android-4.4-kitkat,android-bluetooth,s5
I'm running Android 4.4.2 and I enabled the "Bluetooth HCI snoop log" as described here Sniffing/logging your own Android Bluetooth traffic After turning bluetooth on and off I rebooted the phone. I could not find the log file in the expected location: $ adb pull /sdcard/btsnoop_hci.log remote object '/sdcard/btsnoop_hci.log' does...

Android - ClassCastException - BluetoothManager cannot be cast to android.bluetooth.BluetoothAdapter Error

android,android-activity,android-bluetooth
I'm having an issue right now with some BluetoothAdapter code I wrote. I'm trying to determine what exactly is causing this issue: 04-27 08:27:35.749 7802-7802/com.engineering.yellow E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.engineering.yellow, PID: 7802 java.lang.ClassCastException: android.bluetooth.BluetoothManager cannot be cast to android.bluetooth.BluetoothAdapter at com.engineering.yellow.fragment.SetDevicesFragment.isNotConnected(SetDevicesFragment.java:190) at...

android - Common API which detects all the beacons of different vendors

android,ibeacon,android-bluetooth,android-ibeacon
In my application, we are implementing the beacon functionality using Estimote sdk. But this sdk will detect only their products. Is there any API which detect all the beacons of different vendors and which gives beacon details like UUID,Major and Minor..Does anyone have an Idea. Please let me know.. thanks...

Android TextView text updation on receiving data from Inputstream

android,textview,android-bluetooth
I am coding a client-server app to test communication between two Android Bluetooth devices. On my client, I am reading data from the inputstream object. When I checked by printing on the logcat, the data is being read successfully. However when I try to set the data to a TextView,...

Android BLE notification: method setCharacteristicNotification is enough?

android,bluetooth-lowenergy,android-bluetooth
I'm developing two app one peripheral and one central role. Peripheral 2 characteristic : one (called pippo) with write_noresponse property one (called paperino) with read and notify property y private void addServiceToGattServer() { Service = new BluetoothGattService( UUID.fromString(CostantUUID.xxx), BluetoothGattService.SERVICE_TYPE_PRIMARY); paperino = new BluetoothGattCharacteristic( UUID.fromString(CostantUUID.xxx),...

Bluetooth connections on iOS

android,ios,bluetooth,android-bluetooth,ios-bluetooth
We're trying to observe when Bluetooth devices are connected and disconnected from an iPhone. We essentially want to react (not necessarily in the foreground) when certain devices of interest connect. In Android you can receive the ACL_CONNECTED and ACL_DISCONNECTED actions. What is the equivalent to this behavior on iOS? I...

Android Bluetooth- MAC address

java,android,bluetooth,android-bluetooth
I am trying to get the MAC address of a bluetooth device when I click on a device in the listview. I want to pass in the MAC address in BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address); Is there a way I can extract the MAC address when I choose a device on...

Send & receive data simultaneously over Bluetooth

android,bluetooth,arduino,android-bluetooth
Can I use Bluetooth to send and receive data at the same time and make a full-duplex connection between two devices? I'm trying to connect an Android device and an Arduino (or AVR micro), and send data between them simultaneously (in real time). Thanks!...

How to force Bluetooth LE “Just Works” Pairing in Android

android,bluetooth,bluetooth-lowenergy,android-bluetooth
I have an embedded system running a GATT server that I am trying to connect to via Android. The task is simple: connect to the GATT server, navigate characteristics, and validate read/write capabilities. The problem is when I try and connect with an Android app, it attempts to pair with...

Simulate user click in system activities with Android Espresso framework

android,android-bluetooth,android-testing,android-espresso
In my application I'm turning on BlueTooth when first Activity starts up. It results in the system dialog asking for the authorization to activate the BlueTooth. How can I asset that this dialog is present and click on the "Yes" Button with Espresso ? Is it possible ? I tried...

Android Bluetooth read specific string

android,android-bluetooth
My android program is now able to receive string like "Test" or "Test 123". Now, I need to receive a specific strings for incoming data. In example: ~100 *200 $300. How can I separate these 3 data by filtering the symbol, such as Textbox1 = "100", Textbox2 = "200" and...

Ble Scan service of a device without connecting to it

java,bluetooth,bluetooth-lowenergy,device,android-bluetooth
I want to scan some device with BLE. I only want to show my device, so for know I get the name of the device and if it is the good one I put it in my list. if (device.getName().contains(DEVICE_NAME)) { mDevices.put(device.hashCode(), device); invalidateOptionsMenu(); } My problem is that if...

HDP android implementation

android,bluetooth,android-bluetooth,bluez
I`m trying to link my Android phone(xperia sp) with installed HDP app(sink) to laptop with Ubuntu 14 and Antidote(sample_bt_agent). HDP application: https://android.googlesource.com/platform/development/+/512ea9b6f8cc75ec74a7ab8d1c38dec201667f1e/samples/BluetoothHDP Antidote: http://oss.signove.com/index.php/Antidote:_IEEE_11073-20601_stack And there is an error on Ubuntu: connection initiation error: No matching MDEP found And debug message from Eclipse ADT: Method "CreateChannel" with signature "os" on...

Android reconnect to bluetooth device if connection lost

java,android,bluetooth,android-broadcast,android-bluetooth
My phone is connecting to a bluetooth device and it works normally. It connect and the connection holds. I can change orientation, have my app in the background, I can close app and when I turn it back on it will automatically connect. But from app users I get some...

BLE Device Name irretrievable

android,bytearray,bluetooth-lowenergy,android-bluetooth
I have a project that is scanning for beacons that run on BLE. I can scan for the beacon and list them in a nice custom ListView just fine. However retrieving their names seems to not work. In my OnLeScan callback I use device.getName() which appears to always be returning...

Bluetooth pairing - how to show the simple Cancel/Pair dialog?

android,android-intent,bluetooth,android-bluetooth,bluetooth-oob
I have prepared a simple test project for this question at GitHub. I am trying to create an Android app, which would scan a QR code from a computer screen and then use the data (MAC address and PIN or hash) for easy pairing (bonding) with a Bluetooth device. Similar...

Can I use the Android Bluetooth API on regular Linux distros?

android,linux,bluetooth,android-bluetooth
Is it possible to use the Android Bluetooth API on a regular Linux distribution (eg Ubuntu, or Raspbian) ? My reasons for wanting to do this are: Java is a language I'm very comfortable with The Android API looks very comprehensive with support for Bluetooth LE. I may wish to...

Difference in Bluetooth scanning and discovery on Android

android,android-bluetooth
There are two approaches defined in the Android to find out bluetooth devices. 1. Using bluetoothAdapter.startScan 2. bluetoothAdapter.discover which approach is better. 2nd question, In onLeScan callback, how to check if scanning has been stopped....

Connect via bluetooth to an android device without a custom application

android-bluetooth
I would like to use an arduino with a bluetooth module to modify the volume and skip songs on my phone. All the information I found was about how to code an application that would communicate with a device via bluetooth, which isn't what I am looking for. I want...