connectivity-samples | Multiple samples showing the best practices | Networking library
kandi X-RAY | connectivity-samples Summary
kandi X-RAY | connectivity-samples Summary
This repository contains a set of individual Android Studio projects to help you get started writing Connectivity apps in Android. If you find an issue or bug in one of the projects, feel free to file an issue on this repository with the following information: - The specific project that pertains to the issue (for example: the BluetoothLeGatt project) - Steps to repro the issue, including the API version and Android device model. Example of a good issue: In the BluetoothLeGatt sample, I am unable to see any BLE devices after the initial scan. I ran the sample on a Pixel 2 running API version 28. Examples of bad issues: 1. Bluetooth scanning doesn’t work. 2. My app is crashing when I try to send a large file. 3. How can I support BLE in my app?. Requests for samples related to Android connectivity are also welcome.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Called when a new state changes .
- Display the available GATT services .
- Creates the popup window .
- Start discovery .
- Signals that the specified device is connected to .
- Gets the last seen time since last seen time
- Initializes the ChatService .
- Broadcast a Heart rate measurement .
- Inflates the views .
- Start scanning .
connectivity-samples Key Features
connectivity-samples Examples and Code Snippets
Community Discussions
Trending Discussions on connectivity-samples
QUESTION
I am using the BluetoothLeGatt example from here: https://github.com/android/connectivity-samples/tree/master/BluetoothLeGatt
Assume BLE connection, service and characteristic detection have all happened properly. The following data being sent is value of a characteristic.
From a custom BLE device, I am sending an array of bytes to the smartphone, for example, something line {0x00, 0x01, 0x02, 0x03, 0x04}. In the android program this is received inside the onReceive() function inside BroadcastReceiver mGattUpdateReceiver
in DeviceControlActivity.java
The line
...ANSWER
Answered 2021-Jun-15 at 04:38The example you are using receives the data as a byte array already, but it appends hex representation to the data as string. This is why you get your data in both representations.
You will need to change the example in the file BluetoothLeService.java
on line 149. It is currently reading
intent.putExtra(EXTRA_DATA, new String(data) + "\n" + stringBuilder.toString());
and you would need to change it to
intent.putExtra(EXTRA_DATA, new String(data) + "\n");
if you want to receive only the string representation.
QUESTION
I googled very hard and still no explanations "why?" these permissions are needed to establish offline(no internet) connection between devices. I have simple app that requires only p2p-star strategy to exchange data between devices in master-slave pattern and I have troubles explaining to my users why my app needs them. "Just because lib said so. That's why".
Official documentation also said nothing to me.
"A primary goal of this API is to provide a platform that is simple, reliable, and performant. Under the hood, the API uses a combination of Bluetooth, BLE, and Wifi hotspots, leveraging the strengths of each while circumventing their respective weaknesses. This effectively abstracts the vagaries of Bluetooth and Wifi across a range of Android OS versions and hardware, allowing developers to focus on the features that matter to their users."
PS: as I know ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION are about GPS
PSS: in case this question will be answered here https://github.com/android/connectivity-samples/issues/204
...ANSWER
Answered 2020-Sep-30 at 17:38Because Bluetooth and WiFi scans can reveal the user's location, either as an approximation ("Family Room TV" was discovered, so you must be home) or in detail (Device A, B, and C were last seen at lat/lng X, so we think you're probably at X).
https://developer.android.com/guide/topics/connectivity/bluetooth-le#permissions
QUESTION
I'm trying to write data to a BLE-characteristic, but I got the status 130 in my callback what means GATT_WRONG_STATE. Unfortunately, I have no idea, what state is wrong and how I can change this.
I'm using the BLE-App from the Android-connectivity samples (https://github.com/android/connectivity-samples/tree/master/BluetoothLeGatt) with minor changes so far.
Here's my DeviceControlActivity:
...ANSWER
Answered 2020-Apr-09 at 07:22To use reliable writes, the characteristic properties must include the reliable writes bit. Your characteristic doesn't, so simply use "normal" writes instead.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install connectivity-samples
You can use connectivity-samples 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 connectivity-samples 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
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