android-bluetooth

Android BLE, read and write characteristics

偶尔善良 提交于 2019-11-27 18:10:39
I am currently developing Android BLE, and encounters a lot of problems with the Android BLE stacks.. My development tool is Samsung Galaxy J with Android 4.3. I want to know how can I read a characteristics from the BLE and the write the characteristics (is like i verify what data I have received, and then I send another data using the BLE) and I have serious problem understanding how the Android BLE callbacks works, I dont understand these 5 functions...and the manual is not clear, can anyone good soul explain in simple form??? onCharacteristicWrite onCharacteristicRead

Any way to implement BLE notifications in Android-L preview

做~自己de王妃 提交于 2019-11-27 15:25:38
问题 This question is not about Android notificatinos, but BLE notifications (as the title may hint) I have got basic BLE peripheral mode working on Android-L Is there any way to implement BLE notifications in Android-L preview. I could do some thing like the following to make a charecteritic be able to notify, but trying to listen for BluetoothGattCharacteristic firstServiceChar = new BluetoothGattCharacteristic( UUID.fromString(serviceOneCharUuid), BluetoothGattCharacteristic.PROPERTY_NOTIFY,

Detect all Bluetooth devices (headsets, phones etc) nearby, without forcing the devices in discoverable mode

…衆ロ難τιáo~ 提交于 2019-11-27 14:54:27
My goal: To detect all nearby bluetooth devices(phones, headsets etc.) from my Android application. Here's a nice example from developer.android.com which discovers the bluetooth devices nearby along with the list of already paired devices. My situation: I had two bluetooth headsets turned on and they were not being detected after a successful bluetooth scan! So I dig into the problem and somewhere found that the bluetooth headset needs to be switched to pairing mode in case of being detected by android. To switch the headsets in pairing mode, I had to long press the power button while turning

How to detect when a BLE device is not in range anymore?

南笙酒味 提交于 2019-11-27 11:47:38
问题 I use a LeScanCallback (can not use the newer scan methods because I'm developing for api 18. Not that it matters, since the android 5.0+ apis don't offer this functionality either) to detect when a nearby BLE device is detected: private BluetoothAdapter.LeScanCallback bleCallback = new BluetoothAdapter.LeScanCallback() { @Override public void onLeScan(BluetoothDevice bluetoothDevice, int i, byte[] bytes) { discoveredDevices.add(bluetoothDevice); } }; I am not pairing or connecting with the

How to capture key events from bluetooth headset with android

只愿长相守 提交于 2019-11-27 11:36:41
My app can be controlled by normal headset. It simply overrides "onKeyDown". But key events from bluetooth headset are not captured - why? Or how to capture bluetooth key events? the "log cat" shows the following if i press button on headset: Bluetooth AT recv(3043): AT+VGS=15 AudioPolicyManagerBase(13654): FM radio recording off AudioService(2261): sendVolumeUpdate, isKeyguardLocked...Not to update Volume Panel. VolumePanel(2261): change volume by MSG_VOLUME_CHANGED VolumePanel(2261): onVolumeChanged(streamType: 6, flags: 0) VolumePanel(2261): Call setChangeSeekbarColor(false) i also tried to

Estimating beacon proximity/distance based on RSSI - Bluetooth LE

萝らか妹 提交于 2019-11-27 10:18:04
I've got a simple iOS app which displays the proximity of the Bluetooth LE beacons it detects using such expressions as "immediate", "near" etc. and I need to write something similar on Android. I've followed the tutorial at Android developer and I'm able to list detected devices and now want to estimate the distance/proximity - this is where it's become a problem. According to this SO thread it's just a handful of mathematical calculations. However, they require me to provide a txPower value. According to this tutorial by Dave Smith (and cross-referencing with this Bluetooth SIG statement ),

Communicating between iOS and Android with Bluetooth LE

假装没事ソ 提交于 2019-11-27 10:06:45
I've got a working app using CoreBluetooth to communicate between an iPad (central) and iPhone (peripheral). I have one service that has two characteristics. I have a Nexus 7 running the latest Android 4.3 with BTLE support. Android is a bit late to jump on the BTLE bandwagon but it appears they are approaching it similarly to how iOS did, where initially they only support acting as a central with the peripheral mode coming in a later version. I can load the sample Android BTLE app and browse for nearby peripherals. With my iPhone advertising as a peripheral I can see the value from

How to stream audio from one Android device to another Android device Via Bluetooth?

三世轮回 提交于 2019-11-27 09:52:22
问题 Is it possible to stream audio over bluetooth? During my research I found that is it only possible using A2DP(Advanced Audio Distribution Profile) . And does every android device support A2DP? If not, is it possible to stream audio between two android devices using bluetooth? Please help me understand this. I've looked through the following links: Receive audio via Bluetooth in Android, Google confirms bluetooth audio streaming fix for next version of Android 4.2 How can I stream audio from

How to keep Bluetooth connection background?

喜你入骨 提交于 2019-11-27 08:58:15
I have created a Bluetooth Activity class in the android app, which works fine for all the Bluetooth functionalities like: scanning, pairing, connecting, sending and receiving data. The real problem is when the Activity is destroyed. Bluetooth is disconnecting. how can I make Bluetooth connection throughout the app. and I want to send data to the Bluetooth from other activities. Help me to implement this in an easy way? public class BTActivity extends AppCompatActivity { ArrayList<BluetoothDevice> devices = new ArrayList<>(); BluetoothAdapter mBluetoothAdapter; BluetoothDevice mBluetoothDevice

Android 4.3: BLE: Filtering behaviour of startLeScan()

限于喜欢 提交于 2019-11-27 06:41:36
I'm working on a BluetoothLE sensor device, for which I need to form a one-to-many broadcast of data. As per the spec, peripherals may only have a single master, and due to limitations of the chip and stack I'm designing on, a master can only have three slaves. From what I understand, Android cannot become a BLE slave anyway, so having my device as a master is not an option. Both the BT4 spec and manufacturer documentation talk about another mode of operation, referred to as Broadcast mode. In broadcast mode, a connection is never made, and the application data is transmitted as part of the