BluetoothHelper | Bluetooth helper Java class
kandi X-RAY | BluetoothHelper Summary
kandi X-RAY | BluetoothHelper Summary
This Java Class implements an easy message-based Bluetooth wireless communication layer between an Android device (the client) and a Microcontroller (the server). Using this class you can Connect, Disconnect, Send String messages, Receive String messages via Listener (best way) or by explicit polling, automatically reconnect and check the status of your Bluetooth connection in a simple and thread-safe way. The library is compatible with android 4.0 (API 14) and newer. Here in this repo (in the Arduino/BluetoothHelperExample folder) you can also find a very simple example (around 100 lines of code, including comments) that shows how to use it. You can find a complete implementation of this library in BasicAirData Air Data Bridge. For further information about this library and its usage you can read this article.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Initialize the remote device
- Connects to a remote device
- Clear out pending messages
- Disconnects from the remote device
- Send a message to the remote device
- Returns the state of the connection
- Add a new BluetoothHelper listener
- Called when a message is received
- Fire a listener connection state changed
- Returns the last received message
- Called when a button is clicked
BluetoothHelper Key Features
BluetoothHelper Examples and Code Snippets
Community Discussions
Trending Discussions on BluetoothHelper
QUESTION
I'm creating an Android app that scans all nearby BLE (Bluetooth Low Energy) devices using Android Studio.
I think I have implemented all these documentations:
- https://developer.android.com/guide/topics/connectivity/bluetooth/ble-overview
- https://developer.android.com/guide/topics/connectivity/bluetooth/permissions#java
- https://developer.android.com/guide/topics/connectivity/bluetooth/setup#java
- https://developer.android.com/guide/topics/connectivity/bluetooth/find-ble-devices
But as you can see in the log below, (the problem) there are no BLE devices scanned by the app.
Here are the logs in the logcat:
I think it could happen because the BLE scan callback
is not called (no BLE scan callback in the log).
So my question is what is the solution for my code? Did I miss coding something?
Here is my code
AndroidManifest.xml:
...ANSWER
Answered 2021-Jun-30 at 16:58Finally, I have modified my code so the code now is working. Here it is:
ScanAndPairActivity.java (I'm creating a new activity for scanning and pairing BLE devices):
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install BluetoothHelper
Declare a new BluetoothHelper instance into your activity:
Setup a BluetoothHelperListener to receive the messages and the changes of the connection status:
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page