#dlavoie-plannit
1 messages Β· Page 1 of 1 (latest)
Hi there
Hi
How is the reader connected in this case?
Terminal.getInstance().connectBluetoothReader(
tracing the code on deconnexion logic, Terminal.getInstance().getConnectionStatus indicate CONNECTED juste before calling disconnectReader
Hmm that is strange that the onFailure is not firing at all
Can you provide your code snippet for disconnectReader?
public void disconnectDevice() throws CardPresentException {
AppLog.d(TAG, "disconnectDevice");
try {
final Callback disconnectCallback = new Callback() {
@Override
public void onSuccess() {
// see if we'd be better triggering on onConnectionStatusChange
raiseCardPresentDeviceDisconnected();
}
@Override
public void onFailure(@NonNull TerminalException ex) {
// see if we need to raise error here...
String s = "";
}
};
Reader reader = Terminal.getInstance().getConnectedReader();
if (reader != null) {
Terminal.getInstance().disconnectReader(disconnectCallback);
}
} catch (Exception ex) {
AppLog.e(TAG, "Stripe disconnectDevice failed", ex);
throw new CardPresentException("Stripe disconnectDevice failed",
CardPresentErrorCodes.UNEXPECTED_ERROR.name(), ex.getMessage());
}
}```
Thanks, let me grab a colleague more familiar with Android, one sec.
Just hopping in to let you know we found an Android dev. They're in a meeting, but they should be able to hop in and assist shortly.
no problem! thanks a lot!
π Hello, Can you describe the use-case you're trying to aim here?
1/ I understand you want to disconnect the reader when the payment succeeds, why though?
2/ And why are you expecting the reader to throw fire onFailure / fail disconnection here?
Do you mean its not firing onSuccess and onFailure both?
1-typically, card present payments will occur on the road for our kind of business so not many times a day... so we want to avoid our customer to have to manually disconnect the reader following a payment. That way, reader would shut down itself and preserve battery level.
2-neither onSuccess or OnFailure is triggered. onConnectionStatusChange callback is not fired neither and not exeption thrown during the process... just nothing happen
What type of reader are you testing with?
Can you share the serial number?
WPC323042000078
Are you seeing anything out of the ordinary in your logcat? Any errors/crashes/logs thrown by Terminal SDK?
Can you also share the complete Terminal.getInstance().connectBluetoothReader() function?
yes, on my way
That way, reader would shut down itself and preserve battery level.
We actually recommend you don't calldisconnectReaderto preserve the battery
https://stripe.com/docs/terminal/payments/connect-reader?terminal-sdk-platform=android&reader-type=bluetooth#handling-disconnects:~:text=})%3B-,Don%E2%80%99t,-program%20your%20app
Donβt program your app to call disconnectReader to conserve power. The reader efficiently handles power management using its standby mode.
don't worry, you have the better support channel! of all third party we work with π