#manuel_best-practices
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1463645984558157868
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Good question. Looking in to this and will get back to you. For some extra context, what reader type are you using here? I don't think that will change the API shape but sometimes that info can still be helpful
Thank you! Card Reader M2
Still looking. Out of curiosity, are the devices otherwise connecting and able to make payments?
Yes, is working correctly. Also I can see logs with the software version after the connection.
Hi there - taking over for Pompey, who has to go
I'm not super familiar with the Terminal android SDK - let me see if I can find a colleague who knows more about this.
Hi! I believe it's possible to use the onConnectionStatusChange callback function to get an early software version.
After the status is CONNECTED
Does this happen with all your readers?
I just debugged in this callback and I can see the software version in this case
That's to say you think that's the way you're supposed to access that property?
I assumed you are talking about the ReaderCallback in Terminal.getInstance().connectReader()
The problem is that in this method (onSuccess callback) the software version is "unknown", but in override fun onConnectionStatusChange(status: ConnectionStatus) when the status is CONNECTED the version appear with correct value:
So I assume now that this is the correct moment to get this information without calling the terminal from my code
hi! fyi i'm jumping in to help out here
i can't remember off the top of my head when this becomes available but it sounds like you're on the right track. let me look at my own test app to double check some things
hmmmmm when i run my test app in a simulator at least, i am seeing the software version
are you using a similator or an actual device?
here's all i'm doing in my app
Terminal.getInstance().connectReader(
reader,
connectionConfig,
onConnectReader()
)
}
...
private fun onConnectReader(): ReaderCallback {
return object : ReaderCallback {
override fun onSuccess(reader: Reader) {
val readerEmitSuccess = _connectReaderFlow.tryEmit(reader)
val connectionInProgressEmitSuccess = _connectInProgressFlow.tryEmit(false)
val errorEmitSuccess = _connectErrorFlow.tryEmit(null)
if (!readerEmitSuccess || !connectionInProgressEmitSuccess || !errorEmitSuccess) {
Log.w(TAG, "Failed to emit reader to flow, buffer might be full or no active collectors.")
} else {
Log.d(TAG, "Reader emitted to flow.")
Log.d(TAG, "READER SOFTWARE VERSION")
Log.d(TAG, reader.softwareVersion)
}
}
...```
and then i see this in my logs:
READER SOFTWARE VERSION
1.00.03.32-SZZZ_Generic_v36-580001```
can you try with a simulated device real quick? i can grab my actual device and test there too but it might take me a bit
which SDK version are you using?
good question, lemme double check
this app is running 4.7.2, and yours?
i can try on a different version if needed
also working on getting my physical test device set up now
4.6.0
ok yep, i'm getting the same thing on my physical device
you have the same delay?
let me see if i can test on 4.6.0 without breaking things
no sorry, i am seeing it log as soon as the onConnectReader callback is hit
ok, ok
let me try on 4.6.0 โฑ๏ธ
hmm yep it's working for me on 4.6.0 too
can you share your code where you're calling Terminal.getInstance().connectReader as well as where you define the callback?
also can you confirm if you'll be able to test it out with a simulated terminal device instead of the actual M2? i'm curious if the results will be different at all
it's in the discovery config, 1 sec
this doc walks you through it, but it should be a 1 line change
here's what it looks like in my app. for yours you can literally just add isSimulated = true to your BluetoothDiscoveryConfiguration
timeout = timeout,
isSimulated = simulated
)
...
discoverCancelable = Terminal.getInstance().discoverReaders(
config,
this,
onDiscoveryComplete()
)```
what happens if you just log out reader.softwareVersion in your onSucess?
with simulation is working correctly
not, just one
i wonder if there's something about the device itself or the softwareVersion it's on that's resulting in it showing null
is it fully updated?
where are you actually logging out the reader.softwareVersion in your code? i don't see it in the ReaderCallback
I added the log after I sent you the code
override fun onSuccess(connectedReader: Reader) {
connectivityLogStatus("[Connection] connectReader success: ${reader.serialNumber}")
Log.e("TAG", "${reader.softwareVersion}")
val readerModel =
StripeReaderModel.fromReader(reader = reader, connectionType = connectionType)
val response = StripeReaderResponseModel(reader = readerModel)
cardReaderManager.callbackResponse(CB_CONNECT_READER_RESULT, response.toJson() ?: "")
}
here I have the log
gotcha, and when you run that exact code with the actual M2 reader you're still seeing unknown in the reader.softwareVersion line?
exactly
I think I will use the onConnectionStatusChange callback to manage this information
is ok, is just to show the version
yeah, if that's working for you it should be fine to rely on that
I will try tomorrow a bit more
๐ซก
Now I have curiosity because is working in your enviroment ๐