android-bluetooth

Bluetooth Low Energy : Android Gatt-Client connect to Linux Gatt Server

天大地大妈咪最大 提交于 2019-12-19 04:46:45
问题 I try to connect android to linux via bluetooth low energy GATT mode. There is a example code in Bluez: btgatt-server.c, I use it as server. The Android Side be as the Android official example:Connecting to a GATT Server. That is, use function BluetoothDevice::connectGatt(Context context, boolean autoConnect, BluetoothGattCallback callback). After running, the Android part returned the connection be successful,(the parameter of BluetoothGattCallback::onConnectionStateChange be STATE_CONNECTED

Android: Set Bluetooth Discoverability Unbounded

梦想与她 提交于 2019-12-19 04:22:50
问题 I have spent the last couple of days trying to make an app that keeps my Samsung Galaxy S3 mini (Android 2.1.4) discoverable for an "infinite" amount of time. My code looks currently as follows: package com.example.downtoone; import android.app.Activity; import android.os.Bundle; import android.support.v4.content.LocalBroadcastManager; import android.widget.Toast; import com.example.downtoone.*; import android.bluetooth.*; import android.content.BroadcastReceiver; import android.content

Android: Set Bluetooth Discoverability Unbounded

Deadly 提交于 2019-12-19 04:22:24
问题 I have spent the last couple of days trying to make an app that keeps my Samsung Galaxy S3 mini (Android 2.1.4) discoverable for an "infinite" amount of time. My code looks currently as follows: package com.example.downtoone; import android.app.Activity; import android.os.Bundle; import android.support.v4.content.LocalBroadcastManager; import android.widget.Toast; import com.example.downtoone.*; import android.bluetooth.*; import android.content.BroadcastReceiver; import android.content

Android BLE- How is onScanResult method being called in ScanCallback?

不羁的心 提交于 2019-12-18 19:16:09
问题 This is my first time doing Bluetooth Low Energy in Android project. The project that I am doing is basically to detect all Bluetooth LE devices and connect them to discover their services. I would like to ask if anyone know how onScanResult(), onBatchScanResults() and onScanFailed() methods are being called in ScanCallback? At First, run scanLeDevice() method. BluetoothLeScanner mLEScanner = mBluetoothAdapter.getBluetoothLeScanner(); ScanSettings settings = new ScanSettings.Builder()

Find already paired bluetooth devices automatically, when they are in range

ぐ巨炮叔叔 提交于 2019-12-18 12:17:15
问题 I am no Bluetooth specialist and wondering what possibilities are available to find already paired Bluetooth devices automatically when they are range of each other. Background : In our case an Android application needs to connect to a dedicated accessory via Bluetooth (Rfcomm). Both devices are known to each other (they are paired). The Android application registers a broadcast receiver. During the startup of the application, the app initiates a discovery to find the dedicated accessory. If

Bluetooth Low Energy Connection Parameters for Android, iOS and Win8

≡放荡痞女 提交于 2019-12-18 10:29:36
问题 I've been looking all over the place for the required bluetooth connection parameters that will work for all three of these operating platforms. I'm using the HOGP (Bluetooth over HID GATT) profile for this project. My project is an embedded system written by myself with a BLE module that I have control over the following parameters for connection. Connection Interval Min Connection Interval Max Slave Latency Supervision Timeout Advertising Interval Min Advertising Interval Max My target

Android Bluetooth Low Energy code compatible with API>=21 AND API<21

浪子不回头ぞ 提交于 2019-12-17 19:46:13
问题 I'm developing an app that have to connect with a BLE device, in my code I want to use the new Scan and ScanCallback for BLE implemented from API 21 (Android 5) but I have to maintain the compatibility with Android 4.3 and above. So I wrote the code, for example, in this way: if (Build.VERSION.SDK_INT >= 21) { mLEScanner.startScan(filters, settings, mScanCallback); } else { btAdapter.startLeScan(leScanCallback); } And I have defined the 2 callbacks, one for API 21 and above and one for API 18

How to capture key events from bluetooth headset with android

空扰寡人 提交于 2019-12-17 10:25:31
问题 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):

Estimating beacon proximity/distance based on RSSI - Bluetooth LE

为君一笑 提交于 2019-12-17 10:12:13
问题 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

Android 4.3: BLE: Filtering behaviour of startLeScan()

爷,独闯天下 提交于 2019-12-17 08:33:05
问题 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.