android-bluetooth

BluetoothLeScanner.startScan with Android 6.0 does not discover devices

混江龙づ霸主 提交于 2019-12-03 10:46:19
I'm trying to use the function BluatoothLeScanner.startScan instead of the deprecated one BluetoothAdapter.startLeScan . Yesterday I updated my Nexus 5 to Android 6.0 and since that moment my app does not work anymore. I firstly add the preferences required ACCESS_COARSE_LOCATION as found here, https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-hardware-id . Then I added the permission as described here: https://developer.android.com/training/permissions/requesting.html . But at the end it seems not working, it does not send back the ble devices. This is

How can I enable the new Bluetooth A2DP Sink feature introduced in Lollipop?

风格不统一 提交于 2019-12-03 10:43:07
问题 I am attempting to modify the AOSP android image for Nexus 5 to include support for Bluetooth A2DP Sink. I've found that Google was nice enough to include a hidden build target for the Nexus 5. https://android.googlesource.com/device/lge/hammerhead/+/android-5.0.1_r1/car_hammerhead.mk That includes modified Bluedroid configuration files that allow the device to advertise the A2DP Sink service over Bluetooth. It also changes the class of device to be a Bluetooth Automative Carkit and modifies

Android Bluetooth Low Energy: characteristic.getPermissions() returns 0?

寵の児 提交于 2019-12-03 09:53:33
问题 I am writing an Android BLE application, and I am trying to get the permissions of a certain characteristic. I have already managed to get the characteristic properties with characteristic.getProperties(), and it returns a non-zero value, however, when I use the getPermission() method it returns 0 even though I am sure that the characteristic has PERMISSION_WRITE_ENCRYPTED_MITM (0x00000040). Here is a code snippet // properties int properties = ch.getProperties(); DebugWrapper.infoMsg(

Android bluetooth: Paired devices list

邮差的信 提交于 2019-12-03 07:54:18
问题 I have a bluetooth device with SPP profile and bluetooth version 2.1. I have an app which connects to that device and communicates with it. The device uses "Just Works" pairing technique. I am facing a problem on certain phones like Samsung Galaxy tablet, Galaxy S. The problem is after the user exits from the app, I am closing the sockets and disconnecting from the device. After successful disconnection, it is observed that the device's entry is removed from the paired devices list. 回答1: I

Bluetooth “out of band” (OOB) pairing on Android?

◇◆丶佛笑我妖孽 提交于 2019-12-03 07:37:49
I've been searching the internet and haven't seen anything in the way of how to exactly implement OOB pairing. I was hoping somebody here could point me to some example code to help me out. The chat example in the Android developers site didn't really dive into this type of pairing at all. Basically, I have an Android tablet that I want to securely pair with a device, written in C++, that has no built in display/IO mechanism. The tablet to be paired will act as the GUI/IO interface and I'll send message back and fourth over Bluetooth. Thus I want to securely pair the tablet with each device

Using Microhip's MLDP data streaming from Android or iOS

青春壹個敷衍的年華 提交于 2019-12-03 07:24:36
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? Hi i was in the same problem, but at this moment i have a working code with MLDP, first you need to go to the Module web page: http:/

Print Pdf file via Bluetooth Printer Android

拜拜、爱过 提交于 2019-12-03 04:50:43
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) findViewById(R.id.open); Button sendButton = (Button) findViewById(R.id.send); Button closeButton = (Button)

Android Bluetooth background listener

吃可爱长大的小学妹 提交于 2019-12-03 03:57:15
I am developing an android application with bluetooth chat. I have successfully implemented bluetooth chat with two phones.But my problem is that if I Change to next activity from the chatting activity the connection is lost then I am not able to send messages from second activity. How can I maintain my connection? That is I want to stay connected through out my app. Whenever the user press on exit button then only the connection can disconnect. I want to send message from one activity and receive from another activity this is what I want. I am not able to create a background service with my

Connect multiple devices to one device via Bluetooth

夙愿已清 提交于 2019-12-03 03:06:46
问题 I would like to create a game, where you must connect multiple devices (4+) to a main device (ex. a tablet) via Bluetooth. There would be two apps, a main one to which all data would be send from the phones, and to the phones. Is that even possible? 回答1: Yes, that is possible. At its lowest level Bluetooth allows you to connect up to 7 devices to one master device. I have done this and it has worked well for me, but only on other platforms (linux) where I had lots of manual control - I've

BLE Android - onConnectionStateChange not being called

醉酒当歌 提交于 2019-12-03 01:42:08
I have a problem trying to connect to a peripheral. Sometimes the callback onConnectionStateChange(...) is not called after BluetoothDevice#connectGatt(...) . What I'm trying to achieve is fast and short connections triggered by user action. This situation occurs about 1 in 10 times without specific prior action. It lasts about 20 to 30 seconds or until the application is killed and reopened. The normal sequence of steps I follow is: Scan devices to find the peripheral. Call BluetoothDevice#connectGatt(...) . If it takes longer than 1 second to connect, it means that the connection is "stuck"