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

No printing with Sunmi V2s #20

Open
tscharly opened this issue Oct 9, 2023 · 16 comments
Open

No printing with Sunmi V2s #20

tscharly opened this issue Oct 9, 2023 · 16 comments

Comments

@tscharly
Copy link

tscharly commented Oct 9, 2023

Appversion: 1.2.2

@robertclarkson
Copy link
Member

Hi @tscharly thanks for the bug report.

  • Can you please outline the steps you took to try to print?
  • Does the PDF not get generated?

@tscharly
Copy link
Author

tscharly commented Oct 9, 2023

After succesfull payment, when i press the printersymbol, the pdf is shown but printing doesn't start. Same behaviour when i choose an old transaction from the list.

@robertclarkson
Copy link
Member

We aren't able to start automatic printing unfortunately. Does it work if you then press print on the PDF?
Cop out I know, but doesn't look to easy to access the printer directly from React Native - at least i couldn't work it out!

@robertclarkson
Copy link
Member

@tscharly I've added printer support now for Ciontek and Bitcoinize POS machines. There is a chance the Sunmi just works as well. Are you able to test and let me know? Thanks

@robertclarkson
Copy link
Member

Sunmi printer SDK here https://github.com/AhmedElsayed94/SunmiPrinterSdk

@chloehjung15
Copy link
Contributor

@tscharly
Printing support for Sunmi is now added with the latest version (v1.6.0)
Make sure to set your printer to "Sunmi" in Settings > Printer Settings

@tscharly
Copy link
Author

Sorry, but doesn't work. Fails with message "The service has been disconnected!"

@robertclarkson
Copy link
Member

robertclarkson commented Dec 12, 2023 via email

@tscharly
Copy link
Author

IMG_20231213_174639_654.jpg

@casept
Copy link

casept commented Feb 21, 2024

I sat down with @tscharly and I suspect that the issue is that the SDK you use only supports older devices.

The manufacturer links to AIDL interface definitions in https://github.com/shangmisunmi/SunmiPrinterDemo (direct link: http://sunmi-ota.oss-cn-hangzhou.aliyuncs.com/DOC/resource/re_cn/AIDL%E6%96%87%E4%BB%B6/aidl.zip), some of which are quite different from the ones pasted into https://github.com/AhmedElsayed94/SunmiPrinterSdk. It's probably necessary to modify the SDK so that it checks which device it's running on and uses the correct interface.

Alternatively the official Sunmi SDK could be used, but I don't know whether it's open source.

@robertclarkson
Copy link
Member

robertclarkson commented Feb 21, 2024 via email

@tscharly
Copy link
Author

tscharly commented Feb 21, 2024

@casept and me will booze up with some mates and have a look at this @ our spaceship...

@robertclarkson
Copy link
Member

excellent. i think this sounds like how I code as well. Its certainly how i do tech support

@tscharly
Copy link
Author

tscharly commented Feb 24, 2024

We took a look at this tonight.

The main issue is not that the printer is not supported, but that you are targeting an Android API version > 30, which is not properly supported by the library. This means that printing is broken on all Android 11+ terminals, but yours is probably so old that you didn't notice.

We've managed to upgrade the library to support recent targetSdk versions (see AhmedElsayed94/SunmiPrinterSdk#12). However, until that PR is merged and a new release is cut there's no way to properly depend on the fixed library.

We've managed to build a version locally that has the changes integrated, but only as a debug APK that requires tethering to a PC running the dev server to run. We tried running npx react-native build-android --mode=release, but that just seems to spin forever and do nothing. If you could tell us how you build a release of the app, that'd be appreciated.

@robertclarkson
Copy link
Member

To build an APK

cd android
./gradlew assembleRelease

@tscharly
Copy link
Author

Alright, after fighting the build system some more we managed to generate a release build and it seems to work fine.

Because we can't get Jitpack working with our fork, building the app currently requires building the printer driver as a JAR and copying it into the root of our fork at https://github.com/tscharly/bolt-card-pos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants