star-micronics / react-native-star-io10

react-native-star-io10 is a library for supporting application development for Star Micronics devices.
Other
83 stars 54 forks source link

Is there a way to reconnect to printer when app comes back from offline? #118

Open yongmin86k opened 2 weeks ago

yongmin86k commented 2 weeks ago

Description

Hello,

We are developing a POS app and our users are using not only printers but also scanners.

And, I have a small question what could be the best practice for using a scanner?

Is there a way to reconnect to the printer after the app returns from offline?

For our app,

In most cases, the printer prints, and scans without any issues but if the app goes offline and comes back online, the printer throws an error that the connection is not opened.

How can we close the connection that was already opened? The only way I could find so far is by closing the app & restarting the app.

can-miki commented 1 day ago

Thank you for your question. I guess the app lost connection to the printer when the app went offline.

We recommend implementing a solution on your application's side where you explicitly attempt to reopen the connection with the printer once you detect it's back online. This could involve periodically checking the printer's availability on the network and attempting a reconnection once it's found to be accessible again.

Also, although the supported OS is different, it is the same "Xpand SDK", so I think it may help answer the question this time. (https://github.com/star-micronics/StarXpand-SDK-Android/issues/22)