Closed 0anw0 closed 4 years ago
Solutions That didn't work with me:- 1- Restarting the device after installing the App. (didn't work). 2- Try another device (I used 3 different devices, different manufacture. but didn't work). 3- Remove ComponentDidMount and mount it manually. (didn't work). 4- Disable the Bluetooth. and Enable It again. (The Function runs and produces a BLE error after disabling the Bluetooth). 5- calling the function multiple times in a short time (ex: 10 sec.). Produces a BLE error. error code:600. (Although that all the app has access to the GPS ).
your platform logs were gathered without setting log level on the library. please set it and update the logs
this.manager.setLogLevel(LogLevel.Verbose);
this line should set the log level, shouldn't it?
Yup, my bad. What device are you running on? OS version? Are Location Services turned on? (do not mistake with Location Permissions)
The Devices are ( Lenovo MediaPad 7 [Android 7], HTC Desire 820 [Android 4.4] [ with SensorTag App ], Realme 5 [Android 9] ).
edit: I installed the app on Samsung galaxy j6+ [Android 9], And I faced the same error.
The app has access to location Services { ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION }. And I gave the app access to them manually after installing the application.
I'm wondering if Gradle version, Or React Native version can solve my problem? My Gradle version is 6.0.1/ React Native Version is 0.62.2. If I downgraded any of them. Will this solve my problem?
The app has access to location Services { ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION }. And I gave the app access to them manually after installing the application.
These are permissions not services. "GPS" must be turned on.
And I faced the same error.
You did not mention any error before. What exact error is that?
The App does not preform any scans. The function itself does not run. console.log('' In scan'' ) which is inside the function does not appear in react native cli logs.
I didn't get any useful answers. I'm closing this issue.
Prerequisites
Expected Behavior
A scan should be starting.
Current Behavior
What is the current behaviour?
startDeviceScan isn't even run, When I try to put a [console.log() command]. It doesn't recognize when interpreted.
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
Context
startDeviceScan is not responding. The commands that are inside its scope aren't reached. Interesting thing is that when I disable the Bluetooth, the function runs automatically. And Produces a BLE error!
React-Native-cli LOGS:-
{ "name": "TVB2", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "react": "16.11.0", "react-native": "0.62.2", "react-native-ble-plx": "^2.0.0" }, "devDependencies": { "@babel/core": "7.9.6", "@babel/runtime": "7.9.6", "@react-native-community/eslint-config": "0.0.5", "babel-jest": "24.9.0", "eslint": "6.8.0", "jest": "24.9.0", "metro-react-native-babel-preset": "0.58.0", "react-test-renderer": "16.11.0" }, "jest": { "preset": "react-native" } }
export default class App extends React.Component {
constructor() { super(); this.manager = new BleManager(); this.manager.setLogLevel(LogLevel.Verbose); this.state = { failed: true } }
manualMount() { console.log("Checking Bluetooth") const subscription = this.manager.onStateChange((state) => { if (state === 'PoweredOn') { this.scanAndConnect(); subscription.remove(); } }, true);
}
scanAndConnect() { console.log("Trying to Scan") this.manager.startDeviceScan(null, null , (error ,scannedDevice) => { console.log("In scan") if (error) { console.log(JSON.stringify(error)) return } if (scannedDevice) { console.log("scanned device:", scannedDevice); } this.setState({failed: false}) console.log("Scan Finished") }); }
render() { return (
} }