Android-ble | Android蓝牙4.0操作demo

 by   lidong1665 Java Version: Current License: No License

kandi X-RAY | Android-ble Summary

kandi X-RAY | Android-ble Summary

Android-ble is a Java library. Android-ble has no bugs, it has no vulnerabilities and it has low support. However Android-ble build file is not available. You can download it from GitHub.

Android-ble
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              Android-ble has a low active ecosystem.
              It has 239 star(s) with 101 fork(s). There are 17 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 4 open issues and 3 have been closed. On average issues are closed in 51 days. There are no pull requests.
              It has a neutral 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.
              Android-ble has no build file. You will be need to create the build yourself to build the component from source.
              Installation instructions are not available. Examples and code snippets are available.
              Android-ble saves you 407 person hours of effort in developing the same functionality from scratch.
              It has 967 lines of code, 50 functions and 18 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            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.
            • Initial setup
            • Read body
            • Convert unit
            • Connects to the Bluetooth LE component
            • Connects to the GATT device
            • Makes a filter used for GATT service updates
            • Broadcast an event to a device
            • Method to print 10 chars in given string
            • Convert byte array to hex string
            • Displays the supported GATT services
            • Requests a single characteristic
            • Enable or disables the given characteristic
            • Called when a menu item is selected
            • Stop Bluetooth device
            • Called when a list item is clicked
            • Initializes the BluetoothAdapter
            • Handles a menu item select
            • Initializes the menu options menu
            • Init menu menu menu
            • Method to start the resume device
            • Override this to customize your application
            • Convert byte array to hex string
            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/lidong1665/Android-ble.git

          • CLI

            gh repo clone lidong1665/Android-ble

          • sshUrl

            git@github.com:lidong1665/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

            Consider Popular Java Libraries

            CS-Notes

            by CyC2018

            JavaGuide

            by Snailclimb

            LeetCodeAnimation

            by MisterBooo

            spring-boot

            by spring-projects

            Try Top Libraries by lidong1665

            AndroidRapidLibrary

            by lidong1665Java

            AndroidPDF

            by lidong1665Java

            WeiXinProject

            by lidong1665JavaScript

            wx_ble

            by lidong1665JavaScript