#kylekhus - Terminal

1 messages · Page 1 of 1 (latest)

echo abyss
#

Hello! To clarify, this is in an Android app? And when you say "the timeout still happens" what does that mean exactly?

kind oasis
#

Yea we have have an android app and the Java SDK is also communicating with React Native components!! And "timeout still happens" meaning reader discovery emits a "Bluetooth scan timed out" error

echo abyss
#

Does this still happen when not using the simulated reader?

kind oasis
#

Apologies, simulated is set to false in this case

#

Our discoverReaders function

echo abyss
#

That looks correct to me. Does this same code work as expected if you set the timeout to 0?

kind oasis
#

Let me double check!

#

Yup, works as expected (I see our list of discovered readers and discovery is still going)

echo abyss
#

So the timeout happens after you call Terminal.getInstance().connectBluetoothReader?

kind oasis
#

the timeout no longer happens after we connect a reader, everything works fine after that

#

we dont want the timeout to occur when bluetooth is in discovery and it detects readers nearby (but not yet connected)

#

we only want the timeout to occur when bluetooth is not able to detect any nearby readers

#

but timeout is occurring regardless if it detects readers or not

echo abyss
#

Oh, okay, I think I misunderstood. It sounds like this is behaving as expected. The timeout is for the discovery process itself. If you don't want it to time out you should leave it set to the default of 0.

#

I don't know of a way to only timeout if no readers are found. Can you tell me why you want it to behave that way?

kind oasis
#

Ah okay, and because we want to let our partners know that there could be issues with their reader (they forgot to turn it on, etc) if a reader is not discovered in X seconds. After X seconds, we show a troubleshooting tip on the screen that tells them something like "hey check that your reader is turned on and nearby"

echo abyss
#

Gotcha. I recommend increasing the timeout value to something like a few minutes and then display that info with tweaked wording that's something like "you haven't connected to a reader..." and maybe include instructions about selecting the reader to connect to in addition to what to do if no readers show up.