developermypos/myPOS-Smart-SDK

[BUG] Unable to print a receipt out of debug mode.

Closed this issue · 4 comments

Describe the bug
In order to use your library in a Flutter application, I wrote a plugin for Flutter. This plugin is pretty simple, it's just wrapping your API for payments, refunds and custom printings. Currently, I'm getting some problem on the printing side.
The receipt comes out only in debug mode and on the top of the receipt is readable "????/debug mode".

Source Code of my Flutter plugin
else if (call.method.equals("printReceipt")) {
  Intent intent = new Intent(MyPOSUtil.PRINT_BROADCAST);
  String json;

  List<PrinterCommand> commands = new ArrayList<>();

  commands.add(new PrinterCommand(PrinterCommand.CommandType.TEXT, "Example", 26, PrinterCommand.Alignment.ALIGN_CENTER));

   Gson gson = new Gson();
   json = gson.toJson(commands);

   // Add the commands
   intent.putExtra("commands", json);
   intent.putExtra("bottom_space", false);

   // Send broadcast
   MyPOSAPI.sendExplicitBroadcast(context, intent);
   result.success(1);
}

To Reproduce
Try to print something, but not in debug mode.

Expected behavior
The receipt will be printed also in release mode, but that never happen.

Screenshots

Printing in debug mode

IMG-20210624-WA0002

MyPOS Device:

  • Device: MyPOS Smart N5
  • myPOS OS Version: 1.6.1
  • OS Android Version: 5.1.1
  • SDK Version: 1.0.4

Thank you for your reply and your help! @developermypos

Hello,
I have the same problem, if I print the custom receipt in debug, it prints it for me, but with debug mode and Chinese characters written I think.
But if I do an apk and try it, it doesn't allow me custom printing.
exactly like him.

Hello Anmentone,

This chinese words and debug mode are from manufacturer - Nexgo. On production terminals they will not be visible. They are not from your APP but from debug mode of the device itself.

Kind regards,
Stefan

Hi,
same issue here. My app prints a custom receipts in debug mode, but not in release mode. From the intent PRINTING_DONE I receive the printer_status extra with value 4.

Hi guys, I found a workaround to make it works.
Add in android/app/proguard-rules.pro:
-keep class com.mypos.smartsdk.** { *; }

As a developer or user of an SDK, I would find it appropriate to have this in the documentation.