Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discover method doesn't always return connected printer on Android. #36

Closed
fragilehm opened this issue Nov 15, 2021 · 7 comments
Closed
Labels
bug Something isn't working

Comments

@fragilehm
Copy link
Contributor

I am running the app on Android 11, with Epson TM-m30II Bluetooth printer connected (paired) but in the react-native app, the discover method is inconsistent, it doesn't always find a printer. Like if I put a reload button which calls the discover method it is not always returning the paired printer. Is it a known issue? (couldn't find anything related in https://github.com/tr3v3r/react-native-esc-pos-printer/issues).

@tr3v3r
Copy link
Owner

tr3v3r commented Nov 15, 2021

@fragilehm hello! Does behavior the same for other OS versions? What do you mean by “not always”? Could you please describe a bit in details please?

BTW you don’t need to pair device before discover. Try to disconnect it from device itself and retry discover.

@fragilehm
Copy link
Contributor Author

fragilehm commented Nov 15, 2021

Thanks @tr3v3r for the quick reply, as you can see on the attached gif when I press the reload button discover method is called and it returns the printer but sometimes it doesn't (tried unpairing the printer, getting the same behavior)

Screen.Recording.2021-11-15.at.20.27.32.mov

On iOS it always returns the printer.

@tr3v3r
Copy link
Owner

tr3v3r commented Nov 15, 2021

@fragilehm what about versions below 11?

As an option we can increase discovery time timeout. For now I stop it manually after 5 sec. you can try to change it here, re-run Android build and test.

@fragilehm
Copy link
Contributor Author

@tr3v3r didn't try on android 10, but most of your customers are on 11. I tried putting a higher number there like 10 seconds the printer is always returned. I see iOS also has the timeout 5 * NSEC_PER_SEC, but at least from what I was testing it always returns the printer. So maybe it makes sense to allow passing the params in the discover method to set the scanningTimeout for Android and iOS separately? I can make a PR if you think that this is reasonable.

@tr3v3r
Copy link
Owner

tr3v3r commented Nov 16, 2021

@fragilehm I’d really appreciate it if you could add this possibility to pass timeout param!

@tr3v3r tr3v3r added the bug Something isn't working label Nov 16, 2021
@fragilehm
Copy link
Contributor Author

@tr3v3r can you please review #37

@fragilehm
Copy link
Contributor Author

Closing the issue as #37 addressed it with increasing the timeout for Android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants