#justinadkins
1 messages · Page 1 of 1 (latest)
Hi, I'm getting a teammate who is more experienced with Terminal readers. Thank yo8u for your patience.
Hello! How are you pairing the M2 reader with the mobile device running your app?
We are pairing using Android Terminal SDK
Okay, so you're not paring in the mobile device's settings, correct?
No we are not
How often are you seeing this error?
We only have a dozen or so of these readers in our fleet and have seen it happen to 5 or 6 times.
Is it happening across multiple readers, or is it isolated to a single reader?
Multiple readers
Can you share the code your app is using to pair with the readers?
Discovery:
public void discoverBluetoothReaders(ReadableMap options, Promise promise) {
Log.d(moduleName + "::discovery", "discoverBluetoothReaders");
boolean simulateReader = false;
if (options != null && options.hasKey(SIMULATED)) {
simulateReader = options.getBoolean(SIMULATED);
}
DiscoveryMethod discoveryMethod = DiscoveryMethod.BLUETOOTH_SCAN;
DiscoveryConfiguration discoveryConfiguration = new DiscoveryConfiguration(BLUETOOTH_DISCOVERY_TIMEOUT_SECONDS, discoveryMethod, simulateReader);
discoverReaders(discoveryMethod, discoveryConfiguration, promise);
}
Connection:
public void connectBluetoothReader(ReadableMap options, Promise promise) {
Log.d(moduleName + "::readers", "connectBluetoothReader");
String serialNumber = "";
String locationID = "";
if (options != null) {
if (options.hasKey(SERIAL_NUMBER)) {
serialNumber = options.getString(SERIAL_NUMBER);
}
if (options.hasKey(LOCATION_ID)) {
locationID = options.getString(LOCATION_ID);
}
}
Reader selectedReader = assignReader(serialNumber);
if(selectedReader != null) {
if (Terminal.getInstance().getConnectedReader() == null) {
// Uncomment to test a Reader Update with simulator
// Terminal.getInstance().setSimulatorConfiguration(new SimulatorConfiguration(SimulateReaderUpdate.UPDATE_AVAILABLE, new SimulatedCard(SimulatedCardType.CHARGE_DECLINED_INSUFFICIENT_FUNDS)));
BluetoothConnectionConfiguration bluetoothConfig = new BluetoothConnectionConfiguration(locationID);
Embrace.getInstance().logBreadcrumb("[StripeTerminalModule#connectBluetoothReader] Connecting to bluetooth reader...");
...
Continued:
Terminal.getInstance().connectBluetoothReader(selectedReader, bluetoothConfig, this, new ReaderCallback() {
@Override
public void onSuccess(@Nonnull Reader reader) {
// Reset readers discovered
discoveredReadersList = null;
Embrace.getInstance().logBreadcrumb("[StripeTerminalModule#connectBluetoothReader] Bluetooth reader connection success");
promise.resolve(serializeReader(reader));
}
@Override
public void onFailure(@Nonnull TerminalException e) {
WritableMap connectErrorMap = Arguments.createMap();
connectErrorMap.putMap(ERROR, serializeException(e));
Log.d(moduleName + "::discovery", e.toString());
promise.reject(READER_CONNECTION_ERROR, connectErrorMap);
}
});
} else {
WritableMap alreadyConnectedErrorMap = serializeAlreadyConnectedError();
promise.reject(READER_CONNECTION_ERROR, alreadyConnectedErrorMap);
}
} else {
WritableMap noReaderFoundErrorMap = Arguments.createMap();
noReaderFoundErrorMap.putString(ERROR, "No reader found with provided serial number");
promise.reject(READER_CONNECTION_ERROR, noReaderFoundErrorMap);
}
}
Thanks! I'll look through this and see if anything jumps out at me. In the meantime, can you tell me what version of Android you're using, and the make and model of the Android devices?
The device we are currently having an issue is a Android 11 Lenovo TB-J606F
How often do you see the error? Can you reproduce it reliably, or is it random?
I know you said frequently, but roughly what percentage of the time?
I can't reproduce it reliably. I have a M2 reader that I use during development and haven't seen this issue. We receive reports of it occurring though. Enough for it to be alarming. I'll see if I can get more details on rough percentages.
Reproduction steps would be most helpful, but it sounds like that might be tricky. We're looking into it on our end right now.
This isn't something we've encountered before to my knowledge. I'm trying to loop in someone else internally, but it might be a little while.
Should Android be prompting the user the first time a bluetooth pairing is happening (via the SDK)?
Should Android be prompting the user the first time a bluetooth pairing is happening (via the SDK)?
Android prompting in what way?
like an OS prompt or toast?
@chrome ruin yes
I'm noticing this prompt when trying to repro locally, if I don't accept or let it go away. The reader fails to connect
I believe that is expected and you have to accept that modal
We run out devices via an MDM that has them in a Kiosk mode which isn't surfacing this modal. Is there another approach for pairing that doesn't require this modal?
Hi there 👋 taking over.
Give me a few minutes to get caught up.