#Bryce-Terminal
1 messages · Page 1 of 1 (latest)
Hello, are you saying that after clearCachedCredentials() you can not create another ConnectionToken?
Sorta, if I call clearCachedCredentials nothing seems to happen. Terminal instance is still connected so even if I send it a new connection token it crashes
The main reason I am going down this route when closing the payment screen and starting a new one, once the SDK reader hits Bluetooth connection stage it stops sending information to the ViewModel that the Fragments share with the activity
It sounds odd to me that you need to recreate ConnectionToken every time your customer reopen a page. Could you elaborate more on your current implementation?
I shouldn't need too - and I don't want to try every-time. I am trying to troubleshoot an existing problem which could be persistence memory somewhere. Was trying to use a process of elimination
The current implementation:
PaymentActivity runs two fragments. First is Keypad fragment and then a start payment fragment.
The fragments get information via same ViewModel using by activityViewModels() and LiveData
First time you open Payment Activity it runs the cardreader code. Starts Terminal - finds reader - connects etc.. and runs perfectly
When everything finishes and you leave Payment Activity (so it calls finish()) and you enter the Payment Activity again.
The card reader stops sending information to the ViewModels once it enters the DiscoveryConfiguration of the SDK.
It's as if it's pointing bluetooth calls somewhere else at that point. Hence why I was trying to see if resetting Terminal.getInstance would resolve or give me some understanding on why
The same viewmodel problem occurs if I connect Terminal.getInstance else where in the app (using applicationContext), it's once it reloads on the page DiscoveryConfigu onwards can't seem to talk to ViewModels
Hi @flat ocean can you provide more insights on what problem you want to resolve? So that we can discuss and see if clearCachedCredentials() is really the solution.
I'll try to gather more information later to give a better overview of the situation
It seems that certain SDK methods stop communicating with ViewModels/LiveData after a disconnected and then reconnect is called to the Card Reader. Some of them however work fine
How do you use the SDK with your view model? Can you share the code here?