255kb / cordova-plugin-bluetooth-status

Cordova bluetooth information plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Correct usage of initPlugin?

McGern opened this issue · comments

Hi,

Running on ios 9.1, and after using initPlugin() in deviceReady the values are not yet populated correctly. If I query hasBTLE (for example) in the console it will return the correct value, or if I use a setTimeout (arbitrary time set to 0) it will also give the correct value.

Noticed in the code that initPlugin() is also waiting for deviceReady, which explains the setTimeout working, so was wondering where is the correct place to to call initPlugin?

Thanks,
Jarrod

@McGern, I'm having a similar problem, but using a timeout doesn't seem to resolve it. When I check the value of isEnabled.get(), it's always false until I toggle bluetooth in settings. Then the value is updated correctly -- even if I kill the app and restart it -- until I reinstall or update the app, and then isEnabled is always false until I toggle it in settings again.

Does that look anything like your problem?

Hi, this issue seems to be a duplicate of #2. I will have a look into the issue asap.
Thanks

I haven't had the issue with BT not being enabled, but that just may be
because I haven't looked into it deeply enough. It sounds more like the
issue decided in the link below to #2
On 1 Dec 2015 20:14, "Matthew Lowe" notifications@github.com wrote:

@McGern https://github.com/McGern, I'm having a similar problem, but
using a timeout doesn't seem to resolve it. When I check the value of
isEnabled.get(), it's always false until I toggle bluetooth in settings.
Then the value is updated correctly -- even if I kill the app and restart
it -- until I reinstall or update the app, and then isEnabled is always
false until I toggle it in settings again.

Does that look anything like your problem?


Reply to this email directly or view it on GitHub
#3 (comment)
.

Should be solved in v1.0.4 see #2