android-bluetooth

NoClassDefFoundError during class load for BLE scanning callback

家住魔仙堡 提交于 2019-12-23 02:30:39
问题 I am keep on getting the NoClassDefFoundError when my class is loaded. The code is taken from BluetoothLeGatt project - http://developer.android.com/samples/BluetoothLeGatt/project.html My code: // Device scan callback. private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() { //java.lang.NoClassDefFoundError... @Override public void onLeScan(final BluetoothDevice device, final int rssi, final byte[] scanRecord) { runOnUiThread(new Runnable() {

In leScanCallback device.getName() returns null on few devices

亡梦爱人 提交于 2019-12-23 02:26:11
问题 Checked following post but not helpful on my case : BluetoothDevice always returns null on getName() My problem I am developing an application that scans the nearby Bluetooth device and displays in the home screen.But on few devices(i.e moto G,samsung note2) the device name is null on leScanCallback. My code private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() { @Override public void onLeScan(final BluetoothDevice device, final int rssi, byte[]

Connect to a specific bluetooth paired device

半腔热情 提交于 2019-12-23 01:35:19
问题 I've implemented a list with all of my paired devices, and now I'd like to know if it's possible to connect to some of them only with clicking on the item. For example if my list contains a bluetooth device called X and I want to connect to it (with my app) click on it and the connection is stablished between device and my phone. This is how I list my paired devices : myListView = (ListView) dialog.findViewById(R.id.BTList); BTArrayAdapter = new ArrayAdapter<String>(this, android.R.layout

getBluetoothLeAdvertiser() returns null

若如初见. 提交于 2019-12-22 14:17:41
问题 BluetoothLeAdvertiser advertiser = BluetoothAdapter.getDefaultAdapter().getBluetoothLeAdvertiser(); This returns null. I have tried on an API 21 and on an API 23 device, but with the same result. I have no idea what I am missing? The app builds and runs just fine, until of course the advertiser is used and the app crashes. I appreciate any help provided! :) 回答1: If you check the developer docs, link here. You'll see that the null object is returned in the following case: Returns a

getBluetoothLeAdvertiser() returns null

别等时光非礼了梦想. 提交于 2019-12-22 14:17:11
问题 BluetoothLeAdvertiser advertiser = BluetoothAdapter.getDefaultAdapter().getBluetoothLeAdvertiser(); This returns null. I have tried on an API 21 and on an API 23 device, but with the same result. I have no idea what I am missing? The app builds and runs just fine, until of course the advertiser is used and the app crashes. I appreciate any help provided! :) 回答1: If you check the developer docs, link here. You'll see that the null object is returned in the following case: Returns a

BLE peripheral support Android-L example [closed]

老子叫甜甜 提交于 2019-12-22 10:17:26
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I would appreciate an example of BLE peripheral mode for Android-L. The code that I have gives me strange errors (i.e too many advertisers) which makes no sense as there are no advertisers that i can see from scanner like Lightblue on ios. 回答1: https://github.com/geoaxis/BluetoothTest works on my nexus 5 running

How to query remote mobile phone via Bluetooth as to whether it supports PBAP or not?

安稳与你 提交于 2019-12-22 09:48:45
问题 Suppose two Android mobile phones are paired via Bluetooth and connection is established. How to programmatically determine at the client whether the remote device (the server) supports Bluetooth profiles such as PBAP? And if it does support it, then how to programmatically initiate a PBAP session with the remote device? I have extensively searched the net and so far have been unable to find API support and documentation for the same. Edit Would fetching the remote device's UUIDs be of any

Android 4.4.4 Moto G Bluetooth LE reconnect issue

拟墨画扇 提交于 2019-12-22 04:48:20
问题 I have an app that works great on a Samsung S3 running Android 4.3 however i've having issues on a Moto G running 4.4.4 My BLE peripheral connects and disconnects several times during the apps use. This works fine however sometimes there comes a point where the app/phone no longer reconnects to the peripheral. All gatt commands are run on the main thread, eg. final BluetoothGatt gat = gatt; Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { @Override public

startVoiceRecognition with bluetooth headset is not working

喜欢而已 提交于 2019-12-22 03:48:25
问题 I need to use bluetooth headset with voice recognition, which almost works fine in some devices like S3, S4 and Samsung Grand. However, when I tried same on Nexus 7, I am getting BluetoothHeadsetServiceJni : Failed to start voice recognition, status: 6 error when I am calling startVoiceRecognition() method. I am using the code from this SO page. What are the possible reasons for this issue occur only in some devices? Is there any way to solve this issue? 回答1: I have been check as Narayan

Bluetooth LE Scanning Sometimes Doesn't Find Devices

老子叫甜甜 提交于 2019-12-22 01:52:14
问题 I am scanning for Bluetooth LE devices and running as a Peripheral (running Android 6.0 on a Moto G 2nd Gen) The problem I am having is that sometimes (randomly it seems but often) it will not find any of my other peripheral devices, the other times it works fine. I have a companion iOS device running similar code (both scanning for peripherals and acting as a peripheral), and when the Android scanning can't find the iOS device, my iOS finds the Android device acting as a peripheral just fine