#justinadkins

1 messages · Page 1 of 1 (latest)

snow echoBOT
potent reef
#

Hi, I'm getting a teammate who is more experienced with Terminal readers. Thank yo8u for your patience.

obsidian yew
#

Hello! How are you pairing the M2 reader with the mobile device running your app?

compact shard
#

We are pairing using Android Terminal SDK

obsidian yew
#

Okay, so you're not paring in the mobile device's settings, correct?

compact shard
#

No we are not

obsidian yew
#

How often are you seeing this error?

compact shard
#

We only have a dozen or so of these readers in our fleet and have seen it happen to 5 or 6 times.

obsidian yew
#

Is it happening across multiple readers, or is it isolated to a single reader?

compact shard
#

Multiple readers

obsidian yew
#

Can you share the code your app is using to pair with the readers?

compact shard
#

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);
        }
    }
obsidian yew
#

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?

compact shard
#

The device we are currently having an issue is a Android 11 Lenovo TB-J606F

obsidian yew
#

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?

compact shard
#

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.

obsidian yew
#

Reproduction steps would be most helpful, but it sounds like that might be tricky. We're looking into it on our end right now.

obsidian yew
#

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.

compact shard
#

Should Android be prompting the user the first time a bluetooth pairing is happening (via the SDK)?

chrome ruin
#

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?

compact shard
#

@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

chrome ruin
#

I believe that is expected and you have to accept that modal

compact shard
#

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?

wheat hatch
#

Hi there 👋 taking over.

Give me a few minutes to get caught up.