Comments (16)
Returning true seemed to allow the rest of the plugin to work normally
from ble.
I think your idea is good. I just tried also with simple cordova app, and I'm getting the same undefined there also.
from ble.
@dbenninger You're right. I intended to do that but somehow screwed it up. Will now be part of the soon-to-be-released 2.0.0 version.
from ble.
Depends on how much time I can spend in my IDE vs responding to Github issues š
from ble.
Strange.. it's this line: https://github.com/EddyVerbruggen/nativescript-bluetooth/blob/1907f7643e3f8c781dc68080ca0559db7b1358b5/bluetooth.ios.js#L311
Perhaps you can console.log
the actual state on that device?
from ble.
It's being logged as undefined. Could this be an older iOS version thing?
from ble.
Hmm, older versions should be better than newer actually, because CBCentralManagerStatePoweredOn
seems to be deprecated now.
I'll have to investigate and change the implementation I'm afraid. Perhaps it's best to not rely too much on that method for now..
from ble.
Ok. I can just have it return true for now and see if that lets me connect
from ble.
This seems to be issue also with latest ios for ipod touch 5th generation. Any idea how this could be fixed? Iām now also returning true always, but that not actual fix.
from ble.
It would be very useful to know if changing this bit in bluetooth.ios.js
:
to
Bluetooth._isEnabled = function () {
return Bluetooth._state.manager.state === CBManagerState.PoweredOn;
};
would fix the problem. Can anyone try that perhaps?
from ble.
Both CBCentralManagerStatePoweredOn and CBManagerStatePoweredOn (without dot) are returning number 5.
The issue is that for one reason Bluetooth._state.manager.state is undefined.
from ble.
Ah, I see. Could be it's a timing issue. Can you check that method again a few seconds after you checked it the first time?
from ble.
Same, still undefined.
from ble.
Hmm if it still works when undefined
on your device then I may need to return true
when undefined
or state equals PoweredOn
.. the latter seems to work for most devices, and the former is a fallback. I have no clue how to approach this in any other way.
from ble.
This change somehow didn't make it into the 1.3.1 release. The function is still:
Bluetooth._isEnabled = function () {
return Bluetooth._state.manager.state === CBCentralManagerStatePoweredOn;
};
from ble.
Thanks, how soon?
from ble.
Related Issues (20)
- Monitor Region HOT 1
- bluetooth.connect with autoDiscoverAll hangs on iOS for BT Assigned Numbers HOT 5
- demo-ng - update to latest nativescript and angular HOT 2
- Android - Characteristics Read, Write and Discover not working HOT 1
- service_not_found HOT 3
- Android issue with readCharacteristic call
- error_function_call HOT 6
- (android) startScanning unhandled rejection if user denies location permissions
- (Android) enableGPS does not attempt to enable GPS due to incorrect isGPSEnabled check HOT 1
- (iOS) startScanning() not working HOT 2
- TypeError: Cannot read properties of undefined (reading 'toLowerCase') HOT 6
- sdk 33 , permission BLUETOOTH_SCAN on startScanning HOT 1
- Can't read GATT characteristic on Android SDK 33 HOT 1
- (android) App crash on write HOT 2
- scanning does nothing and does not stop after specified time HOT 5
- Filtering for manufacturerId does not work when scanning HOT 1
- (Android) Function enable throws error on Android 13 HOT 1
- ERROR appears while executing bluetooth.write() (bluetooth class are undefined ) HOT 6
- Scan throws error on android 13+ HOT 3
- Issue running the Bluetooth plugin inside my worker HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ble.