paypal / paypal-here-sdk-android-distribution

Add credit card (swipe & key-in) capabilities to your Android app
Other
84 stars 95 forks source link

Disconnect at midnight? #179

Open DowsingUK opened 4 years ago

DowsingUK commented 4 years ago

I'm wondering why I get a disconnection every night at midnight timezone 0, I have tried different devices with different time zones but I always get a disconnection at the same time I haven't tried the Release SDK is this normal in the Debug SDK? should I expect the same behaviour in the Release SDK?

ppmtscory commented 4 years ago

What disconnection are you referring? Are you referring to the SDK needing reauthorization or the card reader is disconnecting from Bluetooth at the same time every day?

DowsingUK commented 4 years ago

The card reader is disconnecting from Bluetooth at the same time every day although I'm using RetailSDK.getDeviceManager().isConnectedToMiura() to check and reconnect

DowsingUK commented 4 years ago

But so far it's not working after the disconnection isConnectedToMiura always return true

ppmtscory commented 4 years ago

I really don't know why it would automatically disconnect every night at the same time unless there's something happening at that time which causes it to disconnect. If the reader is plugged into power, and connected within your app, then it shouldn't sleep at all even. However, if the app goes to sleep or something happens with the bluetooth on the iPad itself, then it could disconnect. For this, there's a disconnected listener that you can implement to be notified of said disconnections and then you can reconnect.

DowsingUK commented 4 years ago

IMG_2585 Last night I took a picture from what's happening so after that checking it just get disconnected so I think I found a solution every time I want to create a new transaction I check if device is connected using...

PaymentDevice activeDevice = RetailSDK.getDeviceManager().getActiveReader();

if(activeDevice != null && activeDevice.isConnected()) { beginPayment(); } else { reconnect(); }

ppmtscory commented 4 years ago

Yes, that works, else you can use the disconnected listener and connect right away after disconnect as well.

DowsingUK commented 4 years ago

Thank you good to know