android-ble | Palatis 's Android BLE extendsion | Networking library

 by   Palatis Java Version: Current License: No License

kandi X-RAY | android-ble Summary

kandi X-RAY | android-ble Summary

android-ble is a Java library typically used in Networking applications.,roid-ble has no bugs, it has no vulnerabilities, it has build file available and it has high support. You can download it from GitHub.

This is an BLE extension library that wraps Android's BluetootGattService into something easier to use.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              android-ble has a highly active ecosystem.
              It has 7 star(s) with 2 fork(s). There are 4 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              android-ble has no issues reported. There are no pull requests.
              OutlinedDot
              It has a negative sentiment in the developer community.
              The latest version of android-ble is current.

            kandi-Quality Quality

              android-ble has 0 bugs and 0 code smells.

            kandi-Security Security

              android-ble has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              android-ble code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              android-ble does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              android-ble releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed android-ble and discovered the below as its top functions. This is intended to give you an instant insight into android-ble implemented functionality, and help decide if they suit your requirements.
            • Process the Gatt service annotations
            • Process service factory
            • Extracts the factory classes from the given elements
            • Returns true if a CharSequence is null or empty
            • Set native device
            • Gets the native Bluetooth device
            • Gets the bluetooth address of the Bluetooth device
            • Returns a list of all services connected to this device
            • Returns all BluetoothG services matching the specified uuid
            • Register a listener for receiving battery level changes
            • Read the battery level
            • Reads a Bluetooth characteristic descriptor
            • Unregister a listener for a battery level changed event
            • Called when the activity is created
            • Write a Bluetooth characteristic to the service
            • Initializes the factory
            • Reads the firmware revision of this device
            • Called when a characteristic has been changed
            • Notifies all observers of the change
            • Read model number
            • Initialize the messages
            • Read the system id characteristic
            • Reads the current software revision characteristic
            • Read the SerialNumber characteristic of this device
            • Reads the hardware revision characteristic of this hardware item
            • Reads the manufacturer name characteristic
            Get all kandi verified functions for this library.

            android-ble Key Features

            No Key Features are available at this moment for android-ble.

            android-ble Examples and Code Snippets

            No Code Snippets are available at this moment for android-ble.

            Community Discussions

            QUESTION

            Handling Notifications on Android with Multiple BLE Peripheral Connections
            Asked 2022-Mar-28 at 12:57

            So, I am new to Android development and I am trying to connect my device to multiple BLE devices (T-Wristband) to receive frequent notifications (IMU sensor data less than 20 bytes at 50Hz).

            When connecting to multiple devices, I miss data from one or more devices. I suspect the reason is that my BluetoothGattCallback method, onCharacteristicChanged, is working on the same thread for all devices (Note: I have checked that by logging Thread.currentThread.getName()).

            What I have tried:

            1. Android 4.3: How to connect to multiple Bluetooth Low Energy devices

            I suspect everyone adding delays is just allowing the BLE system to complete the action you have asked before you submit another one.

            Problem: I cannot add delays when receiving notifications since it would interfere with my sampling rate, and I am not sure when I might receive new notifications from another device, or even the same device.

            2. Android BLE multiple connections

            To achieve multiple BLE connections you have to store multiple BluetoothGatt objects and use those objects for a different device.

            In this regard: I have tried writing a custom class for my device, TTGODevice, which saves an instance of the corresponding BluetoothGatt upon connection:

            ...

            ANSWER

            Answered 2022-Mar-28 at 12:57

            It seems that BLE on Android cannot handle sampling rates at 50Hz and higher. I am not sure if this is a BLE-related problem or if it has something to do with the onCharacteristicCHanged method being called too frequently. I solved this by sending larger packets of data every 50ms, contrary to my original case at every 20ms. Larger BLE data packets are possible starting from Bluetooth 4.2, which is controlled using the MTU, Maximum Throughput Unit. This blog helped me a lot in understanding the underlying mechanism.

            When receiving large packets of data over BLE at high sampling rates, it is best to use gatt.requestMtu(MY_DESIRED_MTU) with MY_DESIRED_MTU > 20Bytes inside the corresponding BluetoothGattCallback on Android. It should be noted that larger MTU means it takes longer for the data to be written on the BLE characteristic for the server device.

            In short, I am using larger data packets and a larger delay to make up for the limitations in the sampling rate. For a sampling rate of 100Hz on the IMU in the T-Wristband, I am using an MTU of 95 Bytes, requested by the Android device, and a 50ms delay on the timer on the T-Wristband. This allows me to receive five consecutive data samples every 50ms.

            Source https://stackoverflow.com/questions/70177244

            QUESTION

            Is it possible to android to lost part of a command writen to a characteristic via BlueTooth via BLE?
            Asked 2021-Oct-06 at 16:49

            I'm developing an adaptation for an android app, to communicate with a remote control, which has some pre defined commands. I've followed this implementation to do the Bluetooth communication and it's working fine for sometime. This app should communicate with the remote control every 5 minutes or less, and I've been using the app for almost 6 months now. The last week I've some command clashes problem and looking at the logs I couldn't identify why did that happened. The last time that this had happened the app was running for more than 24h, communicating with the remote control, without any communication issue. Two of it's commands have some similar characters, the first one that have to be done, to establish the connection.

            OK_CONN

            And an sniffer command which keeps the pilot awake listening for some sensor data:

            N

            Looking at the logs I can see the answer for command N, after applying the command OK_CONN. Is it possible for a Bluetooth command to lost part of it's data, during an established communication or am I doing something wrong when writing to a characteristic? Should I change the command names to avoid this kind of clash?

            I'm using android 9, at a Sony XPeria XZ phone.

            Edit to clarify @Emil comment

            ...

            ANSWER

            Answered 2021-Oct-06 at 16:49

            Not sure what you mean by name clashes, but Android will always write what you told it to write, without packet loss, as long as you follow the rules to never have more than one outstanding operation (always wait for callback before you send the next operation) and that your data must fit within the maximum length for the corresponding operation.

            Source https://stackoverflow.com/questions/69458764

            QUESTION

            Hex data wont print in my BLE Scanner App
            Asked 2021-Jul-26 at 11:52

            I am trying to make a BLE scanner using Android studio (JAVA). I am using a model code from here:https://github.com/joelwass/Android-BLE-Scan-Example

            I have edited the code to filter for one single device I am currently using as the broadcaster ( the CC2640R2 Dev board).

            I want to be able to print the Hex data stream that I would receive from the broadcast, so that i can use it to define different types of the development board as well as other informative packets.

            From my research i have looked into the getBytes() function but am still yet to find a way it works.

            MainActivity.java

            ...

            ANSWER

            Answered 2021-Jul-23 at 21:39

            The method getBytes() can only be called on an instance of ScanRecord. You can get one from the ScanResult:

            Source https://stackoverflow.com/questions/68497747

            QUESTION

            How to implement a custom UUID for bluetooth broadcast
            Asked 2021-May-06 at 14:56

            I want to change my android device's Bluetooth UUID to a predefined value so that my BLE beacon can recognize it without pairing with it.

            From this question I gathered that I'll have to change the service UUID but I can't find the relevant documents or tutorials.

            How can I achieve this change of UUID via my app?

            ...

            ANSWER

            Answered 2021-May-06 at 14:56

            Have you looked at the Android API documentation?

            You use this https://developer.android.com/reference/android/bluetooth/le/AdvertiseData.Builder#addServiceUuid(android.os.ParcelUuid) function to set a custom service uuid to be advertised.

            A general tutorial for advertising can be found here: https://source.android.com/devices/bluetooth/ble_advertising.

            Source https://stackoverflow.com/questions/67416181

            QUESTION

            Questions on creating a service that connects automatically to a BLE device on android
            Asked 2020-Dec-11 at 00:10

            I am implementing a service that uses the autoconnect feature of bluetoothGatt to connect to the device and monitor it while it is being connected.

            I work on the assumption that the device is already bonded (a coworker is responsible for that part) so autoconnect should not have any problems

            my code is as follows:

            ...

            ANSWER

            Answered 2020-Dec-10 at 21:44

            First of all, if you are intending to distribute your app to Google Play Store, you need to be targeting minimum api level 29 if I'm not mistaken, hence you should be using either JobService along with JobScheduler or WorkManager, instead of Service. This is to support the background limitations from Oreo(26) onwards.

            a) if you properly implement any of the two options I mentioned above, you can write a proper service that will not terminate unless you stop it. Here are some resources on JobService : (resource1, resource2, resource3)

            b) You can re-register as you please upon the onStartJob() method of your JobService, which will recreate your app.

            c) Each time you are done with the peripheral ble device, you need to close the gatt connection with it. Here is a snippet from the BluetoothGatt class

            Source https://stackoverflow.com/questions/65118259

            QUESTION

            Android BLE, scan started, finds devices but does not connect with filter (ESP32 & Samsung)
            Asked 2020-Oct-28 at 21:30

            I have been working through several BLE tutorials to develop an app to connect to an ESP32, but I cannot get the code to connect to the ESP32. I am using a Samsung phone which requires a time delay, but I have tried other phones and still cannot connect the ESP32 to the mobile app.

            If I run a BLE scanner app I can connect to the ESP32, so I believe the ESP32 side is okay. If we scan for devices we can see it in the bluetooth device list.

            The code is setup to detect and connect, I have tried a UUID and device name filer, but it will not connect. The ScanCallback is been triggered and we get the function onBatchScanResults been called, so we can see a list of devices but it will not connect to the ESP32. I think it should connect automatically with the gatt functions.

            I cannot workout why it will not auto connect to the ESP32, as it's seen the devices and the scan connect is been trigged. Any help would be highly appreciated to fix this issue, as I have ran out of idea to fix it.

            ...

            ANSWER

            Answered 2020-Oct-28 at 20:28

            From the logs I see "found something 2" is logged in onBatchScanResults() method of ScanCallback. You should handle this event. Call the same connectGatt which is used in onScanResult() method.

            When device connection successful in order to read messages from device you should subscribe to services and setCharacteristicNotification for PROPERTY_NOTIFY type characteristics.

            Source https://stackoverflow.com/questions/64580202

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install android-ble

            You can download it from GitHub.
            You can use android-ble like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the android-ble component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/Palatis/android-ble.git

          • CLI

            gh repo clone Palatis/android-ble

          • sshUrl

            git@github.com:Palatis/android-ble.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Networking Libraries

            Moya

            by Moya

            diaspora

            by diaspora

            kcptun

            by xtaci

            cilium

            by cilium

            kcp

            by skywind3000

            Try Top Libraries by Palatis

            XAppDebug

            by PalatisJava

            Arduino-Lufa

            by PalatisPython

            arduino-softpwm

            by PalatisC++

            CircularRecyclerView

            by PalatisJava