android-bluetooth

Can an Android 4.4 device act as an iBeacon? [closed]

99封情书 提交于 2019-12-01 06:56:06
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . In an answer to another question, I saw that "You can also transmit as a beacon on rooted Android 4.4.3 devices, but it requires an app installed with system privileges." How can this be done? 回答1: Yes, this is possible on 4.4.3, but the critical API methods startAdvertising() ,

Bluetooth Sending and Receiving Text Data

廉价感情. 提交于 2019-12-01 01:52:13
I'm new to Android developing and I would like to make an app that sends and receive text using bluetooth. I got everything regarding the sending text logically working, but when I try to test it in my phone, I can't see the interface. Here's the Main Activity Code import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build;

Fragment: Bluetooth Service and Fragment Connection

夙愿已清 提交于 2019-12-01 01:15:46
I did debug on my project and my 3. fragment cant connect Bluetooth service. That include send message to other devices. My connection is starting 1st fragment my device id and device name should keep bluetooth service but i connect with below code my connection null and ConnectedThread return null object. So how can i connect bluetooth service java in my fragment again ? I am calling this line on my Fragment mBluetoothConnection = new BluetoothConnectionService(getActivity().getApplicationContext()); And write function in BluetoothService.java: button.setOnClickListener(new View

Fragment: Bluetooth Service and Fragment Connection

随声附和 提交于 2019-11-30 21:40:15
问题 I did debug on my project and my 3. fragment cant connect Bluetooth service. That include send message to other devices. My connection is starting 1st fragment my device id and device name should keep bluetooth service but i connect with below code my connection null and ConnectedThread return null object. So how can i connect bluetooth service java in my fragment again ? I am calling this line on my Fragment mBluetoothConnection = new BluetoothConnectionService(getActivity()

Communication between BLE device and different android apps on same device

可紊 提交于 2019-11-30 21:39:27
I'm new in Android BLE so my question may be uncorrect or naive in some way. If this is the case please explain me where I'm wrong and kindly show me the correct way to manage this scenario. Scenario is the following: my Android app communicates with a BLE device sending commands and getting answers from device using BLE characteristics. Sequence is: Device wakes up the app (the onConnectionStateChange method is called) My app writes a command in a characteristic (I call writeCharacteristic putting the command in value parameter). Device sends back the answer to command to my app (the

Bluetooth Sending and Receiving Text Data

北慕城南 提交于 2019-11-30 21:01:51
问题 I'm new to Android developing and I would like to make an app that sends and receive text using bluetooth. I got everything regarding the sending text logically working, but when I try to test it in my phone, I can't see the interface. Here's the Main Activity Code import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import

Every connection request is being treated as direct connect request + android ble

时光总嘲笑我的痴心妄想 提交于 2019-11-30 14:42:41
We are writing a ble application where want to have a persistent connection with the peripheral we want to connect. For the same purpose we want to re-connect with the peripheral whenever we loose a existing connection. So our android application as a central just tries to reconnect by creating new bluetoothgatt object by calling bluetoothdevice.connectgatt with autoconnect as true. But whenever we try to do that our reconnection gets failed with 12-02 21:47:11.865: D/BluetoothGatt(31963): onClientConnectionState() - status=133 clientIf=6 device=******** callback. because our connection

Android how to read multiple BLE characteristics with a PriorityQueue

做~自己de王妃 提交于 2019-11-30 13:22:57
问题 A bit stuck here, might need your help. I want to read several BLE characteristics at once, some people suggest using PriorityQueue for that. I already know all the uuids, etc. just need a way to read several at once. Could anyone explain how exactly should it look like? Or maybe there is yet another easier solution? Thanks in advance, here is my code: public static final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() { PriorityQueue<BluetoothGattCharacteristic> queue = new

How to call a MainActivity method from ViewHolder in RecyclerView.Adapter?

半城伤御伤魂 提交于 2019-11-30 13:17:17
问题 In a simple app project at GitHub I have only 2 custom Java-files: MainActivity.java contains Bluetooth- and UI-related source code DeviceListAdapter.java contains an Adapter and ViewHolder for displaying Bluetooth devices in a RecyclerView The MainActivity.java contains a method to be called, when user taps on a Bluetooth device in the RecyclerView : public void confirmConnection(String address) { final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address); AlertDialog.Builder

Connecting to a already paired Bluetooth device

*爱你&永不变心* 提交于 2019-11-30 13:10:20
问题 Recently I tried to get a pairing process to work programatically and I succeded. But I recently found out that the users of my application can be connected to several of "interesting" devices. So I have to prompt the user to choose a device to connect to So I have to connect the user to a already paired bluetooth device. But none of my efforts work. I tried running the pairing process again using the: tmp = device.createRfcommSocketToServiceRecord(MY_UUID); and also the following: Method m =