You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey,
So in my app I've implemented a callback to detect for network changes, and when the network is available I'm trying to connect to the printer.
It looks like this:
private fun registerNetworkChangesCallback() {
// just android way to detect network changes:
// https://developer.android.com/training/monitoring-device-state/connectivity-status-type
val networkRequest = NetworkRequest.Builder()
.addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
.addTransportType(NetworkCapabilities.TRANSPORT_ETHERNET)
.build()
connectivityManager.requestNetwork(networkRequest, this)
}
override fun onAvailable(network: Network) {
...
printer.openAsync().await()
...
}
The problem is that sometimes the openAsync() throws an exception: StarIO10IllegalHostDeviceStateException: Network unavailable. errorCode: NetworkUnavailable
How can I fix it to have stable implementation which will always try to connect to a printer after a network change?
Could you please specify how your sdk is detecting whether the network is available so I can use the same method or at least adjust to it?
Thanks for the information.
The phenomenon you reported is new to us as well.
I have created and tested a code similar to yours. However, we are not experiencing this issue.
If possible, could you please provide us with the following information for further investigation?
Android version
StarXpand SDK version
Frequency of occurrence (e.g., 1 in 10 times)
Does this problem occur on other android devices?
Self-printing result
When the printer is turned on while holding down the FEED button, information on the printer itself is printed. Please take a picture of it and attach it to this Issue.
Hey,
So I've tried to reproduce it today but unfortunately I couldn't - which is strange as on the day I've created this issue I had 50% reproducibility ( 5 in 10 times the issue occurred ).
On the day I've opened this issue I could also reproduce it on another device: Elo I-Series 4.0 Value (Android 12) connected to the network using ethernet cable.
StarXpand SDK version is 1.8.0.
I'll try to reproduce this issue again next week - I'll let you know the results.
Description
Hey,
So in my app I've implemented a callback to detect for network changes, and when the network is available I'm trying to connect to the printer.
It looks like this:
The problem is that sometimes the
openAsync()
throws an exception:StarIO10IllegalHostDeviceStateException: Network unavailable. errorCode: NetworkUnavailable
How can I fix it to have stable implementation which will always try to connect to a printer after a network change?
Could you please specify how your sdk is detecting whether the network is available so I can use the same method or at least adjust to it?
Your device where the bug occurs
Lenovo Tab M10 FHD Plus
Your printer
Star SP700 (SP742)
Ethernet or Wi-Fi
Your development environment
ProductName: macOS
ProductVersion: 14.4.1
BuildVersion: 23E224
To Reproduce
Steps to reproduce the behavior:
StarIO10IllegalHostDeviceStateException
occursExpected behavior
After the network is available the
StarIO10IllegalHostDeviceStateException
should not occurThe text was updated successfully, but these errors were encountered: