android-bluetooth

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

为君一笑 提交于 2019-11-26 16:57:41
问题 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

How to keep Bluetooth connection background?

房东的猫 提交于 2019-11-26 14:25:14
问题 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

Android 4.3 Bluetooth Low Energy unstable

两盒软妹~` 提交于 2019-11-26 11:57:48
I am currently developing an application that will use Bluetooth Low Energy (testing on the Nexus 4). After getting started with the official BLE APIs in Android 4.3, I have noticed that after I connect a device for the first time I am rarely able to successfully connect to / communicate with that device or any other device again. Following the guide here , I can successfully connect to a device, scan services and characteristics, and read/write/receive notifications without any issues. However, after disconnecting and re-connecting, I am often unable to either scan services/characteristics or

Can an Android device act as an iBeacon?

自闭症网瘾萝莉.ら 提交于 2019-11-26 10:07:44
问题 Can an Android device act as an iBeacon and figure out when other Android devices come in its range? Do those other Android devices need to have Bluetooth turned on? If a customer comes into my shop and he doesn\'t have my app installed on his device, can iBeacon work, or must he install the app first? There are so many customers are visiting our shop daily, but if they don\'t have my app installed, does the iBeacon concept work? 回答1: UPDATE: This is now possible on Android 5.0, and you can

Android Broadcast Receiver bluetooth events catching

删除回忆录丶 提交于 2019-11-26 05:34:29
问题 I\'m trying to catch bluetooth state changes with Broadcast Receiver. My manifest: <uses-permission android:name=\"android.permission.BLUETOOTH\" /> <application> <activity android:name=\".MainActivity\" android:label=\"@string/app_name\" > <intent-filter> <action android:name=\"android.intent.action.MAIN\" /> <category android:name=\"android.intent.category.LAUNCHER\" /> </intent-filter> </activity> <receiver android:name=\".BluetoothBroadcastReceiver\" android:label=\"@string/app_name\">

How to programmatically tell if a Bluetooth device is connected?

只谈情不闲聊 提交于 2019-11-25 23:37:25
问题 I understand how to get a list of paired devices but how can I tell if they are connected? It must be possible since I see them listed in my phone\'s Bluetooth device list and it states their connection status. 回答1: Add bluetooth permission to your AndroidManifest, <uses-permission android:name="android.permission.BLUETOOTH" /> Then use intent filters to listen to the ACTION_ACL_CONNECTED , ACTION_ACL_DISCONNECT_REQUESTED , and ACTION_ACL_DISCONNECTED broadcasts: public void onCreate() { ...