X-Guard / react-native-flic2

Use Flic 2 within your React Native application with ease.
Other
8 stars 9 forks source link

Did not get disconnection of Flic button when it is not in range #24

Closed Saurabh-Sawla closed 3 years ago

Saurabh-Sawla commented 3 years ago

Dear programmer,

This is a wonderful support for the Flic library. However, we would like to understand how the button disconnection can be established when the Flic button is not in range and how it can be detected again. This is something that we could not get from the library.

Would you be able to add these capabilities to the library?

jdegger commented 3 years ago

Hi @Saurabh-Sawla we kindly redirect your question to the official Flic SDKs as this is not a question for us but for Shortcut Labs.

Search the issues on those repositories, it has been asked & answered before.

Saurabh-Sawla commented 3 years ago

Hi,

So I asked them this question and they say that there is a method that can help us get that status. please check this issue on the Android issue list - https://github.com/50ButtonsEach/flic2lib-android/issues/16

We could not find anything in the react native for this. Is it possible that same information can be obtained in react native.

Regards, Saurabh

jdegger commented 3 years ago

Hi Saurabh,

Please check Flic2Button.getIsReady(); and/or listen for the following events:

      Flic2.addListener('buttonConnectionReady', (eventData) => { console.log(eventData); });
      Flic2.addListener('buttonDisconnected', (eventData) => { console.log(eventData); });
      Flic2.addListener('buttonConnectionCompleted', (eventData) => { console.log(eventData); });
jdegger commented 3 years ago

Please note that these events might trigger at unexpected times. For example, it will trigger when the button goes to sleep even though it's close and it won't connect until you trigger the button again.

Saurabh-Sawla commented 3 years ago

Alright thanks for this info, however, you mean these events may get triggered and provide a false positive. For example, a buttonDisconnected event may get fired even though in reality it isn't disconnected?

Regards, Saurabh

jdegger commented 3 years ago

No, the button is really disconnected, but it doesn't mean that the button is out of reach and does not work.

Saurabh-Sawla commented 3 years ago

Ok. That's fine we will try it out then. Thanks for all your help.