developermypos / myPOS-SDK-Android

myPOS SDK Android enabling to integrate Apps with myPOS Card Terminals for Card Payments processing
49 stars 22 forks source link

Connect multiple applications to terminal #10

Closed emiellohr closed 3 years ago

emiellohr commented 3 years ago

Sometimes it's possible to connect multiple applications to one single terminal. This is not what we want. Is this by design? And if it is, is it possible to turn this off?

Strangely the terminal is not always available on the second application when already connected.

developermypos commented 3 years ago

Hello Emiellohr,

You can use this code to to remove last stored device: SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.remove(Utils.PREFERENCES_LAST_CONNECTED_DEVICE_ADDRESS); editor.remove(Utils.PREFERENCES_LAST_CONNECTED_DEVICE_NAME); editor.apply();

Kind regards, Stefan

emiellohr commented 3 years ago

Hi Stefan. Thanks for your reply, but this is not what I meant. Let me try to explain it more clearly.

The behaviour is that an application (1) is connected to a specific myPos terminal (1). Then I start the application on a second tablet (2) and the same terminal (1) will be visible in the connections dialog. Is it possible to configure that only one application can connect to a single terminal?

developermypos commented 3 years ago

Hello Emiellohr,

myPos terminal is publicly visible Bluetooth connection from any device event if it is already connected. But the multiple connections to it will be rejected.

If you want to pair a specific tablet/terminal couple, you can use POSHandler.getInstance().connectDevice(context, posSN); passing the serial number from the back of the POS device.

emiellohr commented 3 years ago

Hi Stephan,

Thanks for your reply. The "mPOSHandler.connectDevice(context, posSN);" method would indeed be nice, but is not available in 'com.mypos:slavesdk:1.0.2'. I get a: "Expected 1 arguments but found 2" message.

Can you please tell me what I'm doing wrong?

Kind regards, Emiel

developermypos commented 3 years ago

Please try 'com.mypos:slavesdk-beta:2.0.7' instead.

Kind regrads

emiellohr commented 3 years ago

This seems to improve the behavior. When is this version released as a stable version (with some documentation).

developermypos commented 3 years ago

Hi,

I double check your devices software versions and I confirm slavesdk-beta2.0.7 is fully compatible with them. You can find more info into 'new-features' branch of this repository or send an e-mail to online@mypos.com

Thanks