All devices scanned have name equals to null
See original GitHub issueExpected Behavior
Scanning devices should return a name in order to understand which device is which.
Current Behavior
Scanning devices return objects with name
and localName
equals null
:
Device {
id : "2C:F0:EE:19:27:CF"
isConnectable : null
localName : null
manufacturerData : "TAAQBQsUluNJ"
mtu : 23
name : null
overflowServiceUUIDs : null
rssi : -62
serviceData : null
serviceUUIDs : null
solicitedServiceUUIDs : null
txPowerLevel : null
_manager : BleManager
__proto__ : Object
}
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions. Both JS and platform logs can be enabled via setLogLevel function call.
- Library version: 1.0.3
- Platform: currently tested only in Android
- Contents of the
package.json
file:
"dependencies": {
"react": "16.8.3",
"react-native": "0.59.8",
"react-native-ble-plx": "^1.0.3",
"react-native-gesture-handler": "^1.3.0",
"react-navigation": "^3.11.0"
},
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/runtime": "^7.4.5",
"babel-jest": "^24.8.0",
"jest": "^24.8.0",
"metro-react-native-babel-preset": "^0.54.1",
"react-test-renderer": "16.8.3"
},
- Formatted code sample or link to a repository:
import React from "react";
import { PermissionsAndroid, View, Text, Button } from "react-native";
import { BleManager } from 'react-native-ble-plx';
const ProfileScreen = props => {
async function requestCameraPermission() {
try {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION,
{
title: 'Cool Photo App Camera Permission',
message: 'Cool Photo App needs access to your camera',
buttonNeutral: 'Ask Me Later',
buttonNegative: 'Cancel',
buttonPositive: 'OK',
},
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log('You can use the camera');
return true;
} else {
console.log('Camera permission denied');
return false;
}
} catch (err) {
console.warn(err);
return false;
}
}
scanAndConnect = () => {
const permission = requestCameraPermission();
if (permission) {
const bluetoothInstance = new BleManager();
bluetoothInstance.startDeviceScan(null, null, (error, device) => {
if (error) {
console.log(error);
return
} else {
console.log(device);
}
});
} else {
console.log("permission not granted")
}
};
return (
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
<Text>Profile</Text>
<Button
title="Start scanning"
onPress={scanAndConnect}/>
</View>
)
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:12
Top Results From Across the Web
All devices scanned have name equals to null #481
Scanning devices should return a name in order to understand which device is which. Current Behavior. Scanning devices return objects with name and...
Read more >bluetooth - android BluetoothDevice.getName() return null
It will return null if the device does not expose its name in the advertisement or scan response. There is no requirement in...
Read more >BLE Device Names Null - Discussion - Connect IQ
However, the watch seems to always list the device name as null. Is there a way to consistently get the device name from...
Read more >react-native-ble-plx all devices name are null
All devices scanned have name equals to null #481 - GitHub ... Scanning devices return objects with name and localName equals null :....
Read more >Some BLE devices are retuning device name NULL during ...
Some BLE devices on android 13 OS is returning device name as NULL but return name correctly on android 12 and older OS...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t understand how this library reports device
name
andlocalName
asnull
. I simply logged all detected devices, and every single one,null
. Using my smartphone to see all bluetooth devices in the area reveals them with human readable names. Therefore, they are reporting them. I instantiated a manager and scanned for devices. Is there a step i missed?@tyrone2kx oddly enough, it started displaying showing the names soon after. I also noticed sometimes the scan results had duplicates. One might show the name, while the other might not.
It might help to log all the scan results and closely inspect.