android-bluetooth

Save a cache of all services and characteristics of a BluetoothDevice. Possible?

霸气de小男生 提交于 2019-12-24 13:49:45
问题 I have a BluetoothDevice with it's associated BluetoothGatt object. This is a device that the user connects to daily, and it does not have any characteristics or services that change often. Right now in order to interact with the device, after each connect I have to first discover all services, which often adds 1-5 seconds of delay to the whole process. My question is: is it possible to save a cache of my devices' services and characteristics so that I don't have to actually do a call to

How to get access to the BluetoothPairingDialog.java in android?

北城余情 提交于 2019-12-24 12:51:43
问题 Is there any way to forcefully click on "pair button" whenever the Bluetooth pairing dialog appears? 回答1: I don't know how to get access to the pairing dialog, but I was able to "force" pairing in the following way: 1) register a BroadcastReceiver for the action: android.bluetooth.device.action.PAIRING_REQUEST 2) once the action is received, "force" the PIN using reflection: String DEVICE_PIN = "12345"; final BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); if

Prevent onDestroy when Bluetooth connection state changes

百般思念 提交于 2019-12-24 11:46:03
问题 Goal If an already connected bluetooth device disconnects, and an Activity is already running, close the Activity Problem When the bluetooth device connection state changes through BluetoothAdapterProperties: CONNECTION_STATE_CHANGE , it seems like a new Activity is created or the current one restarts. There is nothing in the code that listens and/or should react to bluetooth connection state changes. The problem manifests itself in the use of BroadcastReceivers which in turn starts the

Can not discover available Bluetooth devices

£可爱£侵袭症+ 提交于 2019-12-24 09:12:45
问题 I am trying to discover devices. I am turning on my laptop's and other Bluetooth devices but discovery can't discover Bluetooth devices. I found a lot of questions about this problem but I could not find solution. These are the permissions that I am requesting: <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> Here is my code: import

How to detect click event of connected Bluetooth peripheral device (Selfie stick)?

。_饼干妹妹 提交于 2019-12-24 02:57:22
问题 I have Selfie stick connected to my phone. I am able to find device ID using below code: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_ACL_CONNECTED); this.registerReceiver(mReceiver, filter); } //The BroadcastReceiver that listens for bluetooth broadcasts private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent

Bluetooth LE maximum transmission size

守給你的承諾、 提交于 2019-12-24 02:42:45
问题 We are currently working with Bluetooth LE and want to send a 128 character string to a gatt service. Now the Bluetooth Specs say that the maximum packet size of BLE is 22 bytes, my string will never fit in the packet. We are thinking about chunking it up and send it in iterations. Is this the usual way of doing things? 回答1: Yes, you need to chunk the data into 18 bytes pieces, then send a series of Prepare Write Request s to the Server. Each of this request has 3 parameters: Attribute handle

Error receiving broadcast Intent { act=android.bluetooth.device.action.FOUND flg=0x10}

▼魔方 西西 提交于 2019-12-23 20:22:12
问题 I searched and i didn't find anything symilar. I'm developing a connection between two defices using Bluetooth in Android. And on ACTION_FOUND method, when i tried to make the device information appear on listView, i got that error on logcat. DesafioActivity: public class DesafioActivity extends Activity { private TextView nomeDispositivo; private TextView MAC_Adress; private BluetoothAdapter bthAdapter = BluetoothAdapter.getDefaultAdapter(); private ArrayAdapter<String> bthDispositivosArea;

Android: Bluetooth Low Energy GATT Profile

。_饼干妹妹 提交于 2019-12-23 10:29:12
问题 I am looking to send information from my Android device to a micro-controller (such as an Arduino). Using Bluetooth Classic I simply send a byte array of data to the micro-controller, and process the byte array accordingly. I started reading about Bluetooth Low Energy and I am hearing all this talk about GATT profiles. Why should I create a GATT profile? What is a GATT profile going to do for me in the case of exchanging information from an Android device to a micro-controller? Thanks in

Android: Bluetooth Low Energy GATT Profile

一个人想着一个人 提交于 2019-12-23 10:28:54
问题 I am looking to send information from my Android device to a micro-controller (such as an Arduino). Using Bluetooth Classic I simply send a byte array of data to the micro-controller, and process the byte array accordingly. I started reading about Bluetooth Low Energy and I am hearing all this talk about GATT profiles. Why should I create a GATT profile? What is a GATT profile going to do for me in the case of exchanging information from an Android device to a micro-controller? Thanks in

Successive transfer of bitmap via Bluetooth generate multiple inputstream.read()

六月ゝ 毕业季﹏ 提交于 2019-12-23 03:41:39
问题 I'm developing an android application that transfers images from one device to another. The received image will be stored in the local database of my application created by help of SQLite. To achieve my goals, I've converted the bitmap into byte[] and transferred it to another device by help of outputStream. I did achieve success from the above implementation but, failed in transferring the second image on the connected device. The problem which I am facing is the following: The first